Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wierd behavior

Status
Not open for further replies.

Deleted

Technical User
Jul 17, 2003
470
US
Basically I have this script that when the page loads random html in the page disappears.

Example: <input type="hidden" nme="blah" value="again">

Fails when it shouldn't:

Code:
<script language="javascript">
<!--//
function changeDir(parent) {
        var d = document.this_form;
        d.action.value = "change";
        d.parent.value = parent; 
        d.submit();
}
//-->
</script>

Works but is kind of a retarded way to do this:

Code:
<script language="javascript">
<!--//
function changeDir(parent) {
        var d = document.this_form;
        d.action.value = "change";
        d.parent.value = '' + parent + ''; 
        d.submit();
}
//-->
</script>

Any suggestion or anyone experience this???

 
form.action is a reserved tag for the action of the form. Try using d.elements['action'] or changing the name.

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
I figured it out.. Very weird.. had nothing to do with the javascript at all.. it was several css <style>'s

Ex: <input type="hidden" name="test" value="" style="width:300;">

When the sermi-colon was removed everything works exactly as it should.

Thanks anyways

 
Still makes no sense... Why are you giving your hidden elements a style, anyway? Doesn't hidden imply that they are invisible? Maybe removing the semicolon just negates the attribute and you would be better off removing it altogether.

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
Odd...

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
Figured it out after numerous tests..

It wasn't a javascript issue.

The template system I am using was not returning the 'content-type:text/html\n\n' prior to any html output.

Very annoying.. But I guess things like these keep you on your toes.

Thanks for your help..

 
lol... no problem

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
oh... also, parent is a reserved word in javascript referring to the outer page of a frameset.

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top