Jump to content

otester

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by otester

  1. I managed to get it pass on variables using the alert function to test, but how do you tell what font to use (this example doesn't work unfortunately)? <html> <head> <title></title> <script language="JavaScript"> var x; function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font(x) { if(x == 1) { iView.document.execCommand('fontname', false, Arial); //alert("Test"); } } </script> <body onLoad="Init()"> <FORM ACTION="#" NAME="font2"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <select name="fontChanger" onChange="font(1)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select> </FORM> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html>
  2. This is what I currently have as a test, alert doesn't show <html> <head> <title></title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font(fontname) { if(fontname == Arial) { //iView.document.execCommand('fontname', false, fontname); alert("Arial!"); } if(fontname == Tahoma) { //iView.document.execCommand('fontname', false, fontname); alert("Arial!"); } } </script> <body onLoad="Init()"> <FORM ACTION="#" NAME="font2"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <select name="fontChanger" onChange="font(document.font2.fontChanger.value)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select> </FORM> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html>
  3. I tried this but I don't think it's right: <html> <head> <title></title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font() { iView.document.execCommand('fontname', false, null); } </script> <body onLoad="Init()"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <input type="button" onClick="font()" value="Change Font"> <!--<select name="fontname" onChange="font(document.quest.fontChanger.value)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select>--> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html> Is there a way your meant to tell it which font?
  4. Here: <html> <head> <title></title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font(fontname) { iView.document.execCommand(style.font-family:+fontname;, true, null); } </script> <body onLoad="Init()"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <select name="fontChanger" onChange="font(document.quest.fontChanger.value)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html>
  5. How do you get the execCommand to change the style of text? Currently have a drop down box and used Google but can't find anything on the subject Any ideas? Thanks, otester
  6. Thanks!
  7. How can I implement a word processor into my website which manipulates text in real-time (font size, colour, bold/italics etc.). Any help would be great! Thanks, otester
  8. Also this needs to be in PHP as other script rely on it.
  9. I have a PHP random number generator, however this requires page loads to generate another number. If I put the PHP code in a script file, how can I get a button to refresh/update it with an jQuery/Ajax http request? PHP code: <?php $app_ran = Rand(1,6); echo $app_ran; Any help would be great, Thanks, otester
  10. Works now! Thank you very much and to everyone else who posted!
  11. Is there a way to add a unique div ID for each result?
  12. The button doesn't do anything visually. Btw I don't mean delete from the database I mean just off the screen, basically my web page just lists stuff and users can either choose to keep an item, delete or replace it with another random one.
  13. How do I extract each of the results from the array though? My goal is to be able to list results a delete individual results on the page with jQuery if the user needs to and I was going to do this by putting each result between <div> tags.
  14. My current code lists between 1-6 results from a MySQL array. How do I extract the data from the list and put it into its own variable (eg: $result1, $result2 etc.) ? $ran_x = rand(1,6); $ran_x = rand(1,6); $x_query = "SELECT * FROM `x` ORDER BY RAND( ) LIMIT $ran_x"; $get_x = mysql_query($appearance_query); echo 'x(s): '; echo '<br />'; while($row = mysql_fetch_array($get_x)) { echo $row['Appearance']; } Any help would be great, Thanks, otester
  15. Currently my code picks a random number between 1-6 then extracts that many (random) entries from a list in my database. My current code displays the whole array, how can I chop the array into 6 bits so I can output the data separately (up to 6 list items)? $con = mysql_connect("x","x","x"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("x", $con); $ran_x = rand(1,6); $appearance_query = "SELECT * FROM `x` ORDER BY RAND( ) LIMIT $ran_x"; $get_x = mysql_query($x_query); echo 'x(s): '; echo '<br />'; echo "<ul style='list-style:none;'>"; while($row = mysql_fetch_array($get_x)) { echo "<li>" . $row['x'] . "</li>"; } echo "</ul>"; echo "<br />"; mysql_close($con); Any help would be greatly appreciated, Thanks, otester
  16. Turns out you got to put the functions outside of the document.ready bit: function loadFunction() { var xmlhttp = ''; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } return xmlhttp; } function getAndPopulate(xmlhttp,num,pageToGet) { xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("function_"+num).innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",pageToGet,true); xmlhttp.send(); } $(document).ready(function(){ $('#function_button').click(function() { getAndPopulate(loadFunction(),1,'/scripts/1.php'); getAndPopulate(loadFunction(),2,'/scripts/2.php'); getAndPopulate(loadFunction(),3,'/scripts/3.php'); }); });
  17. Didn't know, I'm new to the whole jQuery scene, only found out it existed when I had a mootools conflict so I had to build my own slideshow. Any help to the last script or anything else would be great!
  18. Edit stopped working so basically I still can't call it
  19. Damn this does save a lot of code, but I have other buttons which need to call scripts individually. How do you call them properly? I tried: $(document).ready(function(){ $('#function_x').click(function() { getAndPopulate(loadFunction(),1,'/scripts/function_x.php'); }); }); But it didn't work, replacing the code with an alert message works so I know every apart from this: getAndPopulate(loadFunction(),1,'/scripts/function_x.php'); EDIT: Hmm seems button might actually be broken I'll re-edit soon. REDIT: Nope button does work just got mixed with another one
  20. Thanks for post but got a response off another forum this morning, turns out you need to do this: ... if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari [color=red]var[/color] xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 [color=red]var[/color] xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } ...
  21. Seems that only one works at a time, each one when called (button press on page) individually (blank out all other functions) works and if I leave them unblanked only the last function works.. How can I get them all to display their data instead of just one of them? Each function is like this, draws data from a MySQL database: function loadFuntion_x() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("function_x").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","/scripts/x.php",true); xmlhttp.send(); } jQuery code that is meant to call all functions: $(document).ready(function(){ $('#function_all').click(function() { loadFunction_1(); loadFunction_2(); loadFunction_3(); loadFunction_4(); loadFunction_5(); loadFunction_6(); loadFunction_7(); loadFunction_8(); }); }); Any help would be greatly appreciated, Thanks, otester
  22. Works a treat, thanks a lot!
  23. I wanted to make my header text into a link (so a user can get back to the main page easily). I've noticed that H1 tags don't behave the same way as normal div tags when it comes to dealing with links. The H1 link just won't respond (stays default blue link colour): HTML: <div id="header_container_menu_item_2"><a href="http://www.punch101.com"><h1 id="title_link">x</h1></a></div> CSS: a.title_link:link { text-decoration: none; color: #F90; } a.title_link:visited { text-decoration: none; color: #F90; } a.title_link:hover { text-decoration: none; color: #F90; } a.title_link:active { text-decoration: none; color: #F90; } Any help at all would be greatly appreciated?
  24. My current workaround (which seems to work ok) is just setting the height of the curtain divs to the height of the wrapper.
  25. I have some curtain/shadowy thing that runs down the sides between the white/orange on my site, but they only work when I set a height %, this however locks the page length which causes problems on a few pages. Is it possible to make the length dynamic but also keep the curtains. Site has a super container, inside that is the left curtain, main container then right curtain. Here is the CSS: html, html body { font-family:arial,helvetica,sans-serif; font-size:12px; color:#000; height:111%; background:#F90; margin-top:0px; } #left_curtain { background-image:url(../images/left_curtain.png); background-repeat:repeat-y; float:left; height:inherit; width:40px; } #right_curtain { background-image:url(../images/right_curtain.png); background-repeat:repeat-y; float:right; height:inherit; width:40px; } Any help would be greatly appreciated, Thanks, otester
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.