Jump to content

scott100

Members
  • Posts

    1,819
  • Joined

  • Last visited

Everything posted by scott100

  1. I not quite sure what your asking for here do you want want it so that when you mouseover something the bomb starts to chase you? if so this should do it <script>var seen=falsefunction startBomb(){ myInterval = setInterval('moveBomb()', speed);}picFollow = new Image();picFollow.src = "http://javascript.internet.com/img/mouse-bomb/bomb.gif";picExplosion = new Image();picExplosion.src = "http://javascript.internet.com/img/mouse-bomb/explode.gif";document.onmousemove = getMousePosition;document.onmouseout = pauseBomb;document.write("<div id=\"diva\" style=\"position:absolute\">");document.write("<img name=\"pic\"src=" + picFollow.src + "></div>");var picX = 20;var picY = 100;var step = 10;var speed = 100;var tolerance = step/2 +1;var mouseX = 0;var mouseY = 0;var mouseOut = true;var followMouse = false;function pauseBomb() {mouseOut = true;}function getMousePosition(e) {mouseX = window.event.x + document.body.scrollLeft;mouseY = window.event.y + document.body.scrollTop;mouseOut = false;if (followMouse) {diva.style.left = mouseX - pic.width / 2;diva.style.top = mouseY - pic.height / 2; }}function calcNewPos() {if (mouseX == picX)return;arg = (mouseY-picY) / (mouseX-picX);mult = 1;if (mouseX - picX < 0)mult = -1;alpha = Math.atan(arg);dx = mult * step * Math.cos(alpha);dy = mult * step * Math.sin(alpha);picX += dx;picY += dy;}function collision() {if ((Math.abs(picX-mouseX) < tolerance) && (Math.abs(picY-mouseY) < tolerance) && (!mouseOut))return true;return false;}function hideAnimation() {diva.style.visibility = "hidden";}function moveBomb() {calcNewPos();window.status = "("+mouseX+","+mouseY+")";diva.style.left = picX - pic.width / 2;diva.style.top = picY - pic.height / 2;if (collision()) {clearInterval(myInterval);pic.src = picExplosion.src;followMouse = true;setTimeout('hideAnimation()', 2000); }}</script><body><br /><br /><p>Mouse over the w3c image below to activate the bomb.</p><img id="w3c" style="position:absolute;top:300px;left:400px;" onmouseover="startBomb()" src="http://w3schools.invisionzone.com/style_images/w3sbanner.gif" /></body> Let me know if you mean something else
  2. Sorted <head><script><!-- Beginfunction textCounter(field, countfield, maxlimit) {if (field.value.length > maxlimit) // if too long...trim it!field.value = field.value.substring(0, maxlimit);// otherwise, update 'characters left' counterelse countfield.value = maxlimit - field.value.length;}// End --></script></head><body><center><form>( You may enter up to 1000 characters. )<br /><textarea name="message" wrap="physical" cols="28" rows="4" onKeyDown="textCounter(this.form.message,this.form.remLen,1000);" onKeyUp="textCounter(this.form.message,this.form.remLen,1000);"></textarea><br /><input readonly type="text" name="remLen" size="3" maxlength="3" value="1000">characters left</form><body>
  3. Does this help you any? <script> function parseStr(str){ var temp = str.split("="); alert(temp[1]); }document.write('<table border="1">')for(var i=0;i<10;i++){ document.write('<tr>'); document.write('<td><img src="http://i1.tinypic.com/noiuqt.png" /></tr>'); document.write('<td><a href="#" title="http://www.somesite.com/index.php?showuser='+i+'" onclick="parseStr(this.title);">Username'+i+'</a></tr>'); document.write('</tr>');}document.write('<table>')</script>
  4. scott100

    a terrible error

    I take it you followed this tutorial: http://www.w3schools.com/php/php_db_odbc.aspmake sure you connect the database through odbc, double check you done this part correctly: Create an ODBC Connection
  5. I just depends on who reads and answers your posts, the menu you were talking about is quite advanced so others might not have reached that section of the w3schools site yet.Hope this sorts the problem
  6. wow that hurt my head <span onclick="goThing()"><img src="http://i1.tinypic.com/noiuqt.png"></img></span><a href="showuser=1">Chocolate570</a>Is this for this site, if so should it not be member Number?
  7. I had a look at the site you posted. When you click on each alien worm it takes you to a new page, there is 4 pages in total all identical appart from the worm.current code <a href="demo2.html"><img src="images/alien_ant.jpg" width="200" height="150" border="0" alt="Alien Ant Worm"></a> try this <img onmouseover="window.location='demo2.html'" src="images/alien_ant.jpg" width="200" height="150" border="0" alt="Alien Ant Worm">
  8. Yes i have Norton Internet Security 2006 aswell , if you look at the name of the variables and functions:var SymRealOnLoad;var SymRealOnUnload;SymOnUnload();SymOnLoad();What do they have in common: the word SymWho makes Norton? SymantecMaybe just a coincedence but it looks like Norton to me Could be something to do with ad or script blocking...
  9. scott100

    2 things

    Why does codebox scroll off the width of the page, it's so annoyingLike this post: http://w3schools.invisionzone.com/index.ph...indpost&p=11453Also, on other forums when you make a post the website remembers what topics you have contributed to by marking them with a star or something, i find that handy because when you visit the site the next day you can quickly see what you've been involved with instead of searching for ages. A visual aid if you like
  10. Yes you've got the idea although i would do it slightly differently, you passed this.src to the hide function which is pointless because it doesn't need a parameter, i would use: onmouseout="hide()"Seen as how you only ever hide one image use this as the hide function:function hide() { document.getElementById('largePic').style.display="none";}
  11. This should get you going, just pass the img src of the thumbnail to a function that displays it as a large pic <html><head><script> function show(page) { var x=document.getElementById('largePic'); x.style.display="block"; x.src=page; }</script><style>img.thumbnail{cursor:pointer;height:100px;width:100px}</style></head><body><img class="thumbnail" onmouseover="show(this.src)" src="http://www.google.co.uk/logos/olympics06_luge.gif" /><br /><img class="thumbnail" onmouseover="show(this.src)" src="http://eur.i1.yimg.com/eur.yimg.com/i/eu/hp/yuk1.gif" /><br /><img class="thumbnail" onmouseover="show(this.src)" src="http://w3schools.invisionzone.com/style_images/w3sbanner.gif" /><!-- This is the large picture --><img id="largePic" src="#" style="display:none;position:absolute;top:10px;left:250px;height:300px;width:500px" /></body></html>
  12. I would only use this on a pop up window, not your main window. but you can if you want <head><script>function check(){var answer = confirm ("Do you want to close this window?")if (answer)window.close();else alert ("Thanks for staying")}</script></head><input type="button" value="close window" onclick="check()" />
  13. I have a script for this but i dont have it on me, off the top of my head try this. put this in the pop up window:<body onload="window.opener.close()" /> That should hopefully do it, you will probably get an alert though saying that you are trying to close the main window (which is a pain)
  14. 2 values are ok, any more and the javascript gets rather tricky, have a look at this site: http://www.htmlgoodies.com/beyond/javascri...cle.php/3471111If you have access to php, it's so much easier, that's what i would recommend
  15. I didn't find that suckerfish menu to be very stable Try this one: http://www.w3schools.com/dhtml/tryit.asp?f...trydhtml_menu10
  16. Glad to hear it, this could be your JavaScript tip of the day
  17. It's not your fault if numpty's cant spell Put in large bold text that they must get the spelling correct for it to work, otherwise you would have to code for tons of possibilities...
  18. Over the past couple of weeks i have noticed this in my source code too, it happens in both IE, FF and Opera. I just ran Norton the other day and my system is clean so who knows what it is This is what i get, i took this straigt from the source code of google, looks the same as boen_robot's: <script language="JavaScript"><!--var SymRealOnLoad;var SymRealOnUnload;function SymOnUnload(){ window.open = SymWinOpen; if(SymRealOnUnload != null) SymRealOnUnload();}function SymOnLoad(){ if(SymRealOnLoad != null) SymRealOnLoad(); window.open = SymRealWinOpen; SymRealOnUnload = window.onunload; window.onunload = SymOnUnload;}SymRealOnLoad = window.onload;window.onload = SymOnLoad;//--></script>
  19. Yes it is possible to change text written on a page, use innerHTML, this should do what you asked for:<a href="http://www.google.com" style="text-decoration:none" onmouseover="this.innerHTML='[Mouseover Link]'" onmouseout="this.innerHTML='Mouseover Link'">Mouseover Link</a>
  20. Having looked at all the languages you said earlier then i think by now you understand OOP, that will make c++ a breeze for you.I was coming at OOP from a complete beginner and found it hard to understand what it all meant, if i had done something like JavaScript before c++ which is more web than software then i think i would have understood OOP quicker.
  21. My first course (outside of HTML) was c++, at first i thought what the ###### am i doing here and found it difficult, after a while though it does just click and everything seems to make so much sence Since then i have done various languages and found that c++ is similar to other languages like JavaScript and PHP, i was able to pick them up fairly quickly.I think once you understand one language then it makes the rest a bit easier, you just have to pick up on syntax changes, which can often trip me up!!For example, i'm learning ASP just now, i've been doing loops for ages in JavaScript and PHP for(i=0;1<10;++) but with ASP they are different for i=0 to 1 step 10. Things like that can be so annoying!!!
  22. Someone else had this problem a while back using IE, i suggested trying FF and it worked after that.Maybe this is just an IE problem?see: http://w3schools.invisionzone.com/index.php?showtopic=2185
  23. You would password protect the database, then allow your php script to access it and create, delete or update info in it. This is how you could connect to a password protected MySQL database through php.$dbhost = 'localhost';$dbuser = 'root';$dbpass = 'password';$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
  24. Yeh i think your right, others use embed maybe? it was just an idea...Making a blog is not that difficult, i had a basic one up and running about a week after starting with PHP and MySQL, i thought it was really powerful stuff and was well chuffed, if you ever want a look i have the php scripts, all you would need to do is create the database.
  25. try this. <head><script>function check(){ var a=document.getElementById('1').value; var b=document.getElementById('2').value; var c=a/b; alert(a+"/"+b+"="+c);}</script></head><body><form>1st Number <input type="text" id="1" /><br />2nd Number <input type="test" id="2" /><br /><br /><input type="button" value="submit" onclick="check()" /></form></body>
×
×
  • Create New...