Function calling in Html/Jscript

Results 1 to 2 of 2

Thread: Function calling in Html/Jscript

  1. #1
    Join Date
    Dec 1969

    Default Function calling in Html/Jscript

    When I call this function from the code below:<BR><BR>&#060;script language="javascript"&#062;<BR>function AddToList(number){<BR> document.write("THE NUMBER WAS " + number)<BR>}<BR>&#060;/script&#062;<BR><BR>&#060;html&#062;<BR>...<BR>&#0 60;body background="xxxx.gif"&#062;<BR>&#060;input type="button" value="Test" onClick="AddToList(5)"&#062;<BR>Here I come to save the day.<BR>...<BR>&#060;/html&#062;<BR><BR>it refreshes the page and writes to the screen "THE NUMBER WAS 5", which is what it is supposed to do, but it doesn&#039t write the next line (Here I come to save the day) nor does it put the background image on the screen. It seems like it just stops reading the code after it hits the Javascript code?<BR><BR>Any help?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Function calling in Html/Jscript

    Since the document.write() happens after the page has loaded & is considered closed, JavaScript starts a new blank document & writes the output. I&#039m sure you want it to write the number - try using input fields & changing their value instead.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts