Jump to content

MrAdam

Members
  • Posts

    489
  • Joined

  • Last visited

Everything posted by MrAdam

  1. hi, can anyone explain HOW to actually go about making a js drop down menu.. much like the "Forum Options" on this forum...i know javascript pretty well now, but i've tried myself and i just couldn't figure out the way of doing it..- Thanks
  2. hi does anyone know if you can send vairables in the url for javascript, like php and asp/aspx ?for example a page like: "index.html?var=blah"then somehow return the values in js?? - thanksi've found a sort-of way of doing it... using HTML domto return the value after the #"document.write(location.hash);".. will work, but.. i still would like to know if there's a way of sending multiple variables.... ?
  3. i don't really understand that..could you try to explain it better?
  4. i've seen this quite a few times, a textarea that can be formatted in different ways like different fonts within it, bold bits of text, italic, all the regulars. does anybody know how to do this? im totally clueless..... i think i put this in the right category but not sure...- Thanks
  5. oh wait, i've sorted it: function menuClose() { var menu = document.getElementById('searchMenu'); document.body.removeChild(menu);}
  6. i used: var searchMenu = document.createElement("searchMenu"); searchMenu.id = 'searchMenu'; searchMenu.style.width = '200px'; searchMenu.style.height = '50px'; searchMenu.style.backgroundColor = '#eeeeee'; searchMenu.style.border = '1px solid #b8b8b8'; searchMenu.style.fontFamily = 'arial'; searchMenu.style.fontSize = '11px'; searchMenu.style.position = 'absolute'; searchMenu.style.top = top; searchMenu.style.left = left; searchMenu.style.padding = '10px'; searchMenu.innerHTML = 'link<br />' + 'link<br />' + 'link<br />'; document.body.appendChild(searchMenu); .. to create a little popup menu, but i want to remove it when i run another function. how do i do this?-thanks
  7. to answer question 2:replace your script with this modded version: <script type="text/javascript"> function customPrompt(title,question,id) { if(!document.getElementById("prompt")) { //create prompt box var box = document.getElementById(id); var promptBox = document.createElement('div'); promptBox.id = 'prompt'; } else { //retrieve prompt box var promptBox = document.getElementById('prompt'); } promptBox.style.width = '200px'; promptBox.style.height = '50px'; promptBox.style.backgroundColor = '#eeeeee'; promptBox.style.border = '1px solid #b8b8b8'; promptBox.style.fontFamily = 'arial'; promptBox.style.fontSize = '11px'; promptBox.style.position = 'absolute'; promptBox.style.top = event.clientY+10; promptBox.style.left = event.clientX+10; promptBox.style.padding = '10px'; //promptBox content promptBox.innerHTML = '<div style="padding-bottom:5px"><strong>' + title + '</strong></div>' + '<div style="padding-bottom:5px">' + question + '</div>' + '<div style="padding-bottom:5px"><select id="opt">' + '<option value="value 1">option 1</option>' + '<option value="value 2">option 2</option>' + '</select></div>' + '<div><input type="button" value="OK" ' + 'onclick="promptDone(\'' + id + '\')"/></div>'; if(!document.getElementById("prompt")) { //display prompt box if it's first time document.body.appendChild(promptBox); } } function promptDone(id) { var box = document.getElementById(id); var p = document.getElementById('prompt'); var sel = document.getElementById('opt'); box.value = sel.options[sel.selectedIndex].value; document.body.removeChild(p); } </script> .. sorry bout the alignment ... lemme know how it goes
  8. does anybody know how to return the positions of an image (ie. top, left), that hasn't been set to position:absolute ? - if it's even possible..for example: <script type="text/javascript">function retrnPos(obj) { alert(' .. image top and image left .. ');}</script><img src="..." onClick="retrnPos(this);" /> -Thanks
  9. haha. silly me. thanks!
  10. hey guys.well here's the problem.. i've made a script, which at one point prints out some HTML that has been saved in a variable, but the problem is i want it to print as just text - not actual HTML. i've tried using an str_replace() function to change the "<" to "<" and ">" to ">" .. but it didn't work, there was no change at all: <?php$code = ".......";str_replace("<", "<", $code);str_replace(">", ">", $code);print $code;?> could anybody tell me why?-hope i explained this well enough. thanks.
  11. MrAdam

    switch problem

    sorted! worked when i changed the variable to "function". i don't know why though lol. but am happy. thankya mate!
  12. MrAdam

    switch problem

    al give it a shot.nope, it's nothing to do with whitespace, wrong case or owt.check this link out..http://www.brothers-united.newbiestyle.co....tions.php?f=addcan see there..
  13. MrAdam

    switch problem

    giving out "value fell through" :S
  14. MrAdam

    switch problem

    hey everyone. iv got a problem with my switch statement... switch ($f) {case "add": addItem(); break;case "remove": removeItem(); break;case "clear": clearItems(); break;} .. i've never tried doing something like that before... but it doesn't seem to work (but gives no errors) .. can anybody see a problem?-Thanks
  15. hi. im trying to create a form uploader script using AJAX technology. I want it all to happen on the same page without refreshing any pages or iframes. Using AJAX to call the php script, i want to send in the filename the location in a variable. for example:uploadfile.php?loc=C:\folder\file.jpgbut in the script... how do i use that in the files array? ( $_FILES[] )-Thanks
  16. im currently trying to make a highly customised webpage, interactive as possible! showcase of what i can do basically. right hand click events were new to me, but that code yo gave me before dcole.ath.cx "<body oncontextmenu="return false">" does the job, thanks alot! But, cud you just explain it a little?-Thanks
  17. I've made a simple javascript to show a menu when the user right clicks. iv made the first simple bit, and the menu appears in the right place -- but the regular right click context menu appears. Is there anyway to prevent this? <html><head><script type="text/javascript">function showRightButtonBox(event) { if (event.button==2) { var x=event.clientX; var y=event.clientY; var box=document.getElementById("rightButtonBox"); box.style.visibility='visible'; box.style.top=y; box.style.left=x; }}</script></head><body onmousedown="showRightButtonBox(event)"><div id="rightButtonBox" style="position:absolute;top:0px;left:0px;width:200px;height:200px;visibility:hidden;"> link1<br />link2<br />link3</div></body></html> -Thanks
  18. Well, on some forums and websites, i have noticed that the textareas have varied styled text. For example clicking a bold button will make some of the text in the textarea bold-- but not all of it! I'm assuming this is done using JavaScript. Does anybody know how to do it?-Thanks
  19. function switchImages(that) { if (document.images) { var current = that.src; if (current=='__# src 1__') { that.src = '__# src 2__'; } else { that.src = '__# src 1__'; } }} HTML: <img src="__# src 1__" onClick="switchImages(this)" /> is that any use... or is it too simple ??
  20. MrAdam

    Images in js

    hiya people, is it possibile in javascirpt to return the width and height of a given image... (not meaning the width="" and height="" attributes), if so... how? Thanks.
  21. MrAdam

    Global Array

    never mind. iv sorted it.
  22. MrAdam

    Global Array

    hey guys. need a little help with an image gallery script im developing. basically, i wanna make a global array. what i want is to have an onLoad event for the page, which sets the array... then buttons to browse thru the pictures... but i cant seem to get the array to be accessibile in the other functions. any tips? - Thanks.
×
×
  • Create New...