HTML - Begginer Question - Connecting Java Script To Text Box.
Hi,
I am basically a complete beginner when it comes to programming, but im trying to learn so I hope someone can help me. (This is an assignment from the university btw). If that matters in any way. I am making a website with different functions. One of them beeing a text box, where you can input a number. And a javascript will square the number for you. The textbox appears as normal on my website, and I think the javascript should be good, but obv if anything is wrong with it please feel free to comment. When I enter the number and press enter, the only thing appering is the raw code of the javascript. Nothing happens basically, so obv im wondering what I have done wrong. Hope someone can help me. So heres the html code: </div> <div id="content"> <fieldset> <legend>Oppgave 1</legend> <form method="get" action="kvadrering.jsp"> <p><input type="text" name="tall"> <input type ="submit" value="send"></p> </form> </fieldset> And heres the javascript: <form> <input type="text" id="input"></input> <script type="int/javascript"> function kvadrering() { var input = document.getElementById("tall").value; var resultat; resultat = Math.pow(input,2); document.write(resultat); } </script> </form> Hope someone can help me=) Similar TutorialsI was given some Java Script code to put in an HTML formatted file. The java script will randomly create an image. What I would like to do do is add text and make it so the text starts at the top of the image and not the bottom like it's doing now. In short, I'd like to have the text wrap around the image that the java script creates. Is this possible, and how do I do it? How to create explorer like menu in Html or java script? eg + Game(inside this Cricket and Football) when click on + sign it become like-- - Game -Cricket -Football Can anybody suggest me, by which command I can do it? Commercial Removals || Removals and Storage||Specialist Removals Hey folks, I have been looking all over the web for hours looking for the script that potspace.com uses that cool little warning thing. No I do not use potspace.com Some one told me about their pop up notifier thing and I want it for my site however It's just a regular site. I want to use that for Website Alerts. =) I really want that script If some one could please just visit potspace.com as soon as they get to the site a div will pop up I like that it's really cool can some one please get me the script that does that. I thought I made it but I didn't it just stayed on the page 24/7 LOL it didn't have that re'direct back to the page button. Also It only shows up one time per a session.!! Hi, i am creating a web page dynamically through ajax like this here i am creating a td element and appending a button element to it Code: var td5= document.createElement("TD"); td5.style.whiteSpace = "nowrap"; td5.setAttribute("id", "button" + hostname); var button=document.createElement("input"); button.setAttribute("type", "button"); button.setAttribute("id", "updatebutton" + hostname); button.setAttribute("value", "Click here"); button.setAttribute("onclick", "alert('OK')"); td5.appendChild(button); it appearing good on web page the but when i click the button, where i am not getting supposed alert Code: button.setAttribute("onclick", "alert('OK')"); line is not showing effect and when i try like this Code: button.onclick=new Function (alert('hi')); when my IE loads the page i am getting alert where as , alert must come after clicking the button any work around please Thanks R Which you think i should go with if I am using drop down menus for my site? CSS dropdown or Java? There is a lot of nifty programs out there that generate this dropdown menu for you, but what are the disadvantages? Should I create using CSS in the page itself, which seems more difficult to do and more time consuming... I am having trouble trying to create a table that each table cell changes colour on mouseover and mouseout. I have posted my codes so far where I have managed to change the cursor on mouseover and mouseout. Any help would be most appreciated. This is table.html Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="/Tests/table.js"></script> </head> <body> test table <table border="1" class="pictures" style="margin-left: 300px" width="300px"> <tr > <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>1</p></td> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>2</p></td> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>3</p></td> </tr> <tr> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>4</p></td> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>5</p></td> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>6</p></td> </tr> <tr> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>7</p></td> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>8</p></td> <td onmouseover="cursor_hand()" onmouseout="cursor_clear()"><p>9</p></td> </tr> </table> </body> </html> This is table.js Code: function cursor_hand(){ document.body.style.cursor = 'pointer'; } function cursor_clear() { document.body.style.cursor = 'default'; } How can I run HTML from Javascript? What I mean is that from etc. index.html I will load a file.js script, which will include the whole HTML. Not sure if I can explain myself correctly, do you know what I mean? On http://www.thomasmckee.com/scroller.html, how can I align the image of the car to the left of the scroller with no spacing between them and the total size be 960w by 150h? I mean, how do I butt them next to each other? If you can, will you email your answer to thomas@thomasmckee.com? Hi, i have some scripts running my page and they are displayed one on top one under and one under in middle. How do i modify the scripts so all will be shown under. The web page with scripts is here Now this code is shown bottom left and its shown in a good position: <!--/Start Trafic.ro/--> <script type="text/javascript">t_rid="rohanmediacom";</script> <script type="text/javascript" src="http://storage.trafic.ro/js/trafic.js" ></script><noscript><a href="http://www.trafic.ro/top/?rid=rohanmediacom" target="_blank"><img border="0" alt="trafic ranking" src="http://log.trafic.ro/cgi-bin/pl.dll?rid=rohanmediacom"/></a> <a href="http://www.trafic.ro">Statistici web</a> </noscript> <!--/End Trafic.ro/--> Now i want this code next to the one above and its code is: -- Start cod www.probanner.ro --> <center> <script language="JavaScript"> document.write('<s'+'cript language="JavaScript" src="http://www.probanner.ro/work.php?n=2675&size=2&j=1&c=&code='+new Date().getTime()+'"></s'+'cript>'); </script> <NOSCRIPT> <IFRAME SRC="http://www.probanner.ro/work.php?n=2675&size=2&c=" width=125 height=125 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling="no"></IFRAME> </NOSCRIPT> </center> <!-- Stop cod www.probanner.ro --> How do i do that ? Cheers how to fire a event which performs Ctrl + A from java script? Thanks R Hello, I got a program, but I am unable to execute it, the addition of two variables is not executing in the output, I am unable to find the mistake in the program, plz any one find it and let me know the mistake.. Here is the Program ***************************** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <script type="text/javascript"> var firstnum,secondnum,num1,num2,sum; fistnum = window.prompt("enter the first number","0"); secondnum = window.prompt("enter the second number","0"); num1 = parseint( firstnum ); num2 = parseint( secondnum ); sum = num1 + num2; document.writeln("<h1> the sum is "+ sum + "</h1>"); </script> <body> <p> Click Refresh (or Reload) to Run the script once again </p> <!-- <input name="submit" type="button" onclick="document.writeln();"--> </body> </html> *********************** Is there a way to have my 'website' display the website description directly to the right of the navigational buttons?? Right now my website is displaying the website description directly under the navigational buttons to the right and I want it to display the website description on the same line as the navigational button.... Here is my code: Code: <HTML> <head> <body style="background-color:black"> <title>Zahn Logics</title> <h1 style="text-align:center; color:#ffffff"><u>Zahn Logics</u></h1> <table border="1" width="15%" cellpadding="0"> <td bgcolor="#ffffff" style="text-align:center"> <a href="http://www.zahnlogics.com/philosphy" style="color:red;font-size:20px"> Philosophical Ideas</a> <br /> </td> </table> <table border=1" width="15%" cellpadding="0"> <td bgcolor="#ffffff" style="text-align:center"> <a href="http://www.zahnlogics.com/movie_reviews" style="color:red;font-size:20px"> Movie Reviews</a> <br /> </td> </table> <table border="1" width="15%" cellpadding="0"> <td bgcolor="#ffffff" style="text-align:center"> <a href="http://www.zahnlogics.com/music_reviews" style="color:red;font-size:20px"> Music Reviews</a> <br /> </td> </table> <table border="1" width="15%" cellpadding="0"> <td bgcolor="#ffffff" style="text-align:center"> <a href="http://www.zahnlogics.com/quotes" style="color:red;font-size:20px"> Quotes</a> <br /> </td> </table> <center><table border="1" width="30%" cellpadding="5"> <td bgcolor="#ffffff" style="text-align:center"> <p style="align:center">This website will include philophical idea's, music reviews, movies reviews, funny sotries, and much more! Please visit the site for frequent updates and changes. There is a lot for you to learn and a lot for me to teach, and a lot for me to learn and a lot that YOU can teach!</p> </td> </table></center> </body> </head> </HTML> any help will be appreciated, thanks! how to make java script (countdown) like rapidsahre/4shared? please...the code..!! to insert in blogger post? dear guys: i have a javascript code which shows 10 recent post of my blog by RSS, there is a advertise of that site at the bottom of it, some friend told me to add : <div> tags to it and define width and height for it and for the height change the number until the ad disappears... also he told me to put the flow on "hidden" but i don't understand much can u help me out? here is an example: Code: <script type='text/javascript' src='http://rssReader.com/code.php?t=1&back=_fff&color=_444&box=_fff&max=10&rss=http://sokkan.ir/post/rss/' ></script> Okay I did warn you all in the intro lounge. I want to add free games from here http://freegames.org.uk/html/connect4.html to the schools site and I can't get it to work. I am using *whispers* Front Page, okay I know I should eb using something else but for the mo, tis all i have got. Please please someone tell me what to do and how to do it.......in simple english please, pretending you are talking to a blonde. ( no offence to blondes and by the way I am not one.) Help. Hello all! In my job, I talk to a customer or another rep, solve their problem, and note their accounts respectively. To avoid unnecessary repetition and typing the same thing over and over, I had knocked up a little html page (stored on my hd) with a javacode that had my most frequently used notes, such that I could click a form button, and the note was copied to the clipboard. Then I could just tab back to my working software and paste the note into the account. This worked beautifully until the company updated the security in our system, and now no page may use java. With my little html app, I just had a page full of pressable buttons that had one or two keywords on them, so that I knew which note I was picking. Having all of the notes listed longhand and having to select them by hand just takes so long, when I had such an elegant solution before. Does anyone know a method of accomplishing this task without using Java? hiii all, i am making 2 html pages. one is parent window and another is child window but i want, when i click on a link of child window , parent page will load but with diff frame on parent page i am able to reload the parent pag but the same form will appear so how can i load diff form when parent page is reload?? please mention code for both child and parent page and i am using html e\with java script please reply thanks Hi all, I am trying to make my menu for my future web site. I am new to CSS + PHP, so please forgive my ignorance. My html file contains this: Quote: <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Meditation</title> </head> <body> <?php include("header.php");?> </body> </html> It is saved as meditation.html My PHP file contains this: Quote: <div> <ul> <li><a href="home.html">Home Page</a></li> <li><a href="gallery.html">Gallery Page</a></li> <li><a href="about.html">About Page</a></li> <li><a href="contact.html">Contact Page</a></li> </ul> </div> It is saved as header.php My CSS file contains this: Quote: [...] /*<--Begin Header--> /* #header{ position:relative; height:60px; background-color:#2946F3; width:100%; display:block; overflow:auto; } /*<--End Header-->/* [...] The site I will be making is educationbeyondtheclassroom.com After I upload these and go to educationbeyondtheclassroom.com/meditation.html I receive a blank page. When I view source, the html is their from the meditation page, but the PHP + CSS that I am trying to connect don't appear to be in right. Any help would be most appreciated! Thank you, Ryan I want to make a form that when you type in it it doesnt show what you are typing, i want it to show "Albert please answer the following question" and then you type a semi colon it goes into another box (irrelevant) but when you type a ? in the second box the actual phrase that you typed in the first box (the one that was hidden by my phrase) to come up under the whole thing, and then when you hit the "new question" button it should reset itself. i figured that the way you could do this is by connecting the first box with the answer box but i cant figure out how to make this happen iwhtout using php. |