JavaScript - Conversion Script Not Showing Results
Similar TutorialsFixed.
hi, on my site, http://www.jbiddulph.com/john-drag.html when i move the box within the box, the results are only shown when I click on the firebug icon?! Can someone please help me here? I would like the results to be shown OnMouseUP thanks I'd be grateful for any help please. I've just started to build my first ever sencha app and am pleased with the results so far, but am now stuck on one thing. I've built a search form and want to be able to display the results on the same page, but this is where I'm stuck. The form works and sends the results using GET, but it doesn't send it to the correct place. I want to show it on the same page (I've built a php file called search.php to handle the results), but it reloads the whole app with the variables in the url. I've tested all of the code away from the app and it works perfectly so I know the problem isn't with the code, but more with my lack of understanding of Sencha so would be extremely grateful for any help. Code: searchForms = new Ext.TabPanel({ fullscreen: true, title: 'Search', displayField: 'text', sto searchForm, iconCls: 'search', items: [{ id: 'searchSubmit', xtype: 'form', standardSubmit : true, scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Keywords', defaults: { // labelAlign: 'right' labelWidth: '35%' }, items: [{ xtype: 'textfield', name: 'keywords', id: 'keywords', placeHolder: 'EG: Music, TV', autoCapitalize : true, required: true, useClearIcon: true }] }, { xtype: 'fieldset', title: 'Advanced Search', items: [{ xtype: 'selectfield', name: 'genre', id: 'genre', label: 'Genre', options: [{ text: 'All', value: ' ' text: 'Country', value: '1' text: 'Sci-Fi', value: '2' text: 'Western', value: '3' }] }, { xtype: 'selectfield', name: 'media', id: 'media', label: 'Media', options: [{ text: 'All', value: ' ' text: 'Music', value: '1' text: 'TV', value: '2' text: 'Movie', value: '3' }] }] }, { layout: 'vbox', defaults: {xtype: 'button', flex: 1, style: 'margin: .5em;'}, items: [{ text: 'Search', ui: 'confirm', scope: this, hasDisabled: false, handler: function(){ searchForms.submit({ url: 'search.php' }); } }, { text: 'Reset', ui: 'decline', handler: function(){ searchForms.reset(); } }] }] }] }); I've then tried to use this to display the results on the same page, but as I say this just doesn't work. It doesn't call the search.php page at all. I've made sure all of the files (except the index.js file which is in a js folder) are in the same directory as the index.html file. I've also tried to load the file in the app seperately by using: Code: Ext.regModel('mobile', { fields: [ {name: 'text', type: 'string'} ] }); var searchForm = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'search.php?keywords=test', reader: { type: 'tree', root: 'items' } } }); and that works perfectly so I know that all of the php stuff is working and does work with Sencha Touch, but I'm just not sure how to get it to only work when somebody clicks 'search' I'd be grateful for any help with this as I've spent days searching the web to get this fix, but nothing seems to be working I don't know if this is of help, but the main javascript file is: Code: var tabPanel; var homePanel = new Ext.Panel({ title: 'Home', iconCls: 'home', fullscreen: true, scroll:{direction:'vertical',threshold:7}, items: [{ html: '<center><p>Home</p></center>' }] }); var servicePanel = new Ext.Panel({ title: 'Services', iconCls: 'team', fullscreen: true, items: [{ html: '<center>Please choose a service</center>' }] }); var searchPanel = new Ext.Panel({ title: 'Search', iconCls: 'search', fullscreen: true, items: [{ html: '<center>Search</center>' }] }); var feedtabpanel = new Ext.Carousel({ title: 'More', iconCls: 'more', fullscreen: true, sortable : true, xtype:'panel', scroll:{direction:'vertical',threshold:7}, items: [ { title: 'Contact', html : '<center><h1>Contact Us</h1></center>', }, { title: 'Feedback', html : '<center><h1>Let us know what you think<h1></center>', }, { title: 'Tell a friend', html : '<center><h1>Tell your friends how much you love this app</h1></center>', } ] }); searchForms = new Ext.TabPanel({ fullscreen: true, title: 'Search', displayField: 'text', sto searchForm, iconCls: 'search', items: [{ id: 'searchSubmit', xtype: 'form', standardSubmit : true, scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Keywords', defaults: { // labelAlign: 'right' labelWidth: '35%' }, items: [{ xtype: 'textfield', name: 'keywords', id: 'keywords', placeHolder: 'EG: Music, TV', autoCapitalize : true, required: true, useClearIcon: true }] }, { xtype: 'fieldset', title: 'Advanced Search', items: [{ xtype: 'selectfield', name: 'genre', id: 'genre', label: 'Genre', options: [{ text: 'All', value: ' ' text: 'Country', value: '1' text: 'Sci-Fi', value: '2' text: 'Western', value: '3' }] }, { xtype: 'selectfield', name: 'media', id: 'media', label: 'Media', options: [{ text: 'All', value: ' ' text: 'Music', value: '1' text: 'TV', value: '2' text: 'Movie', value: '3' }] }] }, { layout: 'vbox', defaults: {xtype: 'button', flex: 1, style: 'margin: .5em;'}, items: [{ text: 'Search', ui: 'confirm', scope: this, hasDisabled: false, handler: function(){ searchForms.submit({ url: 'search.php' }); } }, { text: 'Reset', ui: 'decline', handler: function(){ searchForms.reset(); } }] }] }] }); Ext.regModel('mobile', { fields: [ {name: 'text', type: 'string'} ] }); var searchForm = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'search.php', reader: { type: 'tree', root: 'items' } } }); var store = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'areas.php', reader: { type: 'tree', root: 'items' } } }); var nestedList = new Ext.NestedList({ fullscreen: true, title: 'Location', displayField: 'text', sto store, iconCls: 'locate', }); nestedList.on('leafitemtap', function(subList, subIdx, el, e) { var store = subList.getStore(), record = store.getAt(subIdx), recordNode = record.node, title = nestedList.renderTitleText(recordNode), card, preventHide, anim; if (record) { card = record.get('card'); anim = record.get('animation'); preventHide = record.get('preventHide'); } if (card) { tabPanel.setCard(card, anim || 'slide'); tabPanel.currentCard = card; } }); var services = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'subcats.php', reader: { type: 'tree', root: 'items' } } }); var servicesList = new Ext.NestedList({ fullscreen: true, title: 'Services', displayField: 'text', sto services, iconCls: 'team', }); servicesList.on('leafitemtap', function(subList, subIdx, el, e) { var store = subList.getStore(), record = store.getAt(subIdx), recordNode = record.node, title = servicesList.renderTitleText(recordNode), card, preventHide, anim; if (record) { card = record.get('card'); anim = record.get('animation'); preventHide = record.get('preventHide'); } if (card) { tabPanel.setCard(card, anim || 'slide'); tabPanel.currentCard = card; } }); Ext.setup({ icon: 'icon.png', glossOnIcon: false, tabletStartupScreen: 'tablet_startup.png', phoneStartupScreen: 'phone_startup.png', onReady: function() { tabPanel = new Ext.TabPanel({ tabBar: { dock: 'bottom', layout: { pack: 'center' } }, fullscreen: true, ui: 'dark', animation: { type: 'cardslide', cover: true }, items: [ homePanel, nestedList, servicesList, searchForms, feedtabpanel ] }); } }) Not sure if I'm in the right category, apologies if I am not.. I have a small flash/javascript streaming mp3 player on my site that works fine in Chrome and Safari, but doesn't show up at all in Firefox, IE, or Opera. the site is he www.thehordeandtheharem.com/index2.html the player is in the top left corner. I don't even know where to begin troubleshooting this as I didn't write the player myself, but copied it from another site. If anyone could shed any light on this for me I would be very grateful, thanks! I am having some trouble with this form and I was hoping someone could help me with it. It is not returning any errors, it is simply not returning the results of the form fields. The clear form works, the redirect works, the layout is fine, just no results. I am just beginning to learn Javascripts and I know this is a pretty basic script, but could someone be so kind to show me what it is I am doing wrong and teach me the right way to do this? I know it has to be something very simple but I keep going over it and i can not see what I am doing wrong. Rather than just post a snipit of the code I included the whole form so I do not forget to include any information. Thanks guys, I really appreciate it! Code: <form name="evaluation" action="http://www.YOURURL.com/webformmailer.php" target="_self" method="post"><input value="Submission" name="subject" type="hidden" /><input value="evaluationreturn.html" name="redirect" type="hidden" /> <span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-weight: bold;"><br /> <table bgcolor="F7F5F2" border="0" cellpadding="0" cellspacing="0" width="456"> <tbody> <tr> <td><span style="color: rgb(40, 89, 161);">Comment 1</span><br style="color: rgb(40, 89, 161);" /> <br style="color: rgb(40, 89, 161);" /> <span style="color: rgb(40, 89, 161);">Comment 2</span><br style="color: rgb(40, 89, 161);" /> <br style="color: rgb(40, 89, 161);" /> <span style="color: rgb(40, 89, 161);">comment 3</span><br /> <br /> </td> </tr> <tr> <td height="28" valign="top"> <table style="width: 456px; height: 52px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="width: 137px; text-align: left; color: rgb(40, 89, 161);" class="text_1">Your name:</td> <td style="width: 40px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 271px;"><input name="yourname" class="form_1" type="text" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="28" valign="top"> <table style="width: 456px; height: 52px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="width: 137px; text-align: left; color: rgb(40, 89, 161);" class="text_1">Business name:</td> <td style="width: 40px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 271px;"><input name="businessname" class="form_1" type="text" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="75" valign="top"> <table style="width: 456px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="text_1" style="padding-top: 3px; width: 138px; text-align: left; vertical-align: middle; color: rgb(40, 89, 161);">Business Location:</td> <td style="width: 38px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 272px;"><textarea name="location" class="form_1"></textarea></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="40" valign="top"> <table style="width: 456px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="padding-top: 3px; width: 138px; text-align: left; vertical-align: middle; color: rgb(40, 89, 161);" class="text_1">Business Hours:</td> <td style="width: 38px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 272px;"><textarea name="businesshours" class="form_1"></textarea></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="28" valign="top"> <table style="width: 456px; height: 50px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="text-align: left; width: 143px; color: rgb(40, 89, 161);" class="text_1">Reservation required?</td> <td style="width: 34px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 271px;"><input name="reservation" class="form_1" type="text" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="28" valign="top"> <table style="width: 456px; height: 50px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="width: 138px; text-align: left; color: rgb(40, 89, 161);" class="text_1">Reservation Telephone Number:</td> <td style="width: 39px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 271px;"><input name="reservationphone" class="form_1" type="text" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="28" valign="top"> <table style="width: 456px; height: 50px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="width: 138px; text-align: left; color: rgb(40, 89, 161);" class="text_1">E-mail address:</td> <td style="width: 39px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 271px;"><input name="email" class="form_1" type="text" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="28" valign="top"> <table style="width: 456px; height: 50px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="width: 138px; text-align: left; color: rgb(40, 89, 161);" class="text_1">Your contact number:</td> <td style="width: 39px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 271px;"><input name="yournumber" class="form_1" type="text" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td height="91" valign="top"> <table style="width: 456px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="text_1" style="vertical-align: top; padding-top: 3px; width: 138px; text-align: left; color: rgb(40, 89, 161);">Select dates to perform evaluation: From/To <br /> Maximum of 30 days</td> <td style="width: 38px;"><img src="images/spacer.gif" height="1" width="1" /></td> <td style="width: 272px;"><textarea name="performdate" class="form_2"></textarea></td> </tr> <tr> </tr> </tbody> </table> </td> </tr> </tbody> </table> <br /> </span></span> <table style="text-align: left; width: 458px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="width: 220px; text-align: center;"> <p> <input value="Clear Form" onclick="reset(); return false;" type="reset" /></p> <input value="alpha" name="form_order" type="hidden" /> </td> <td style="width: 218px; text-align: center;"> <p> <input value="Submit" onclick="submit();" type="submit" /></p> <input value="alpha" name="form_order" type="hidden" /> </td> </tr> </tbody> </table> <span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-weight: bold;"></span></span></form> I am having trouble with a script that works with the link invisibly which you can see the cursor change to a pointer hand when hovering next to "Email:". If I copyed and pasted the script below Code: <script language=JavaScript> <!-- var user = "name"; var host = "domain.com"; var link = user + "@" + host; document.write("<a hre" + "f=ma" + "ilto:" + user + "@" + host + ">" + link + "</a>"); //--> </script> It would show if you placed the script in the body portion of a blank HTML page. In my website below I can't figure out why the link doesn't show and is invisible. Any suggestions on how to fix this? This emailHide.html.txt file is below, to view in HTML remove the .txt extention and save and view in browser. view the rest of my comments works on the first page but when i extend the search results the rest of the view comments wont expand. click View all 3 comments and it will show all comments then click more button try to click the view all comments on the next comment and nothing happens but the screen jumping up to the top. http://www.runningprofiles.com/membe...ll_Script.php# Why is this?? What do i need to do to fix it? PHP Code: <!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>9lessons Applicatio Demo</title> <link href="frame.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript" src="jquery.oembed.js"></script> <script type="text/javascript"> $(function() { $('.more').live("click",function() { var ID = $(this).attr("id"); if(ID) { $("#more"+ID).html('<img src="moreajax.gif" />'); $.ajax({ type: "POST", url: "http://www.runningprofiles.com/members/shout/data/ajax_more.php", data: "lastmsg="+ ID, cache: false, success: function(html){ $("ol#updates").append(html); $("#more"+ID).remove(); // removing old more button } }); } else { $(".morebox").html('The End');// no results } return false; }); }); $(function() { $(".view_comments").click(function() { var ID = $(this).attr("id"); $.ajax({ type: "POST", url: "../viewajax.php", data: "msg_id="+ ID, cache: false, success: function(html){ $("#view_comments"+ID).prepend(html); $("#view"+ID).remove(); $("#two_comments"+ID).remove(); } }); return false; }); }); $(function() { $(".comment_button").click(function() { var element = $(this); var boxval = $("#content").val(); var dataString = 'content='+ boxval; if(boxval=='') { alert("Please Enter Some Text"); } else { $("#flash").show(); $("#flash").fadeIn(400).html('<img src="ajax.gif" align="absmiddle"> <span class="loading">Loading Update...</span>'); $.ajax({ type: "POST", url: "update_ajax.php", data: dataString, cache: false, success: function(html){ $("ol#update").prepend(html); $("ol#update li:first").slideDown("slow"); document.getElementById('content').value=''; $('#content').value=''; $('#content').focus(); $("#flash").hide(); $("#expand_url").oembed(boxval); } }); } return false; }); //comment slide $('.comment').live("click",function() { var ID = $(this).attr("id"); $(".fullbox"+ID).show(); $("#c"+ID).slideToggle(300); return false; }); //commment Submint $('.comment_submit').live("click",function() { var ID = $(this).attr("id"); var comment_content = $("#textarea"+ID).val(); var dataString = 'comment_content='+ comment_content + '&msg_id=' + ID; if(comment_content=='') { alert("Please Enter Comment Text"); } else { $.ajax({ type: "POST", url: "comment_ajax.php", data: dataString, cache: false, success: function(html){ $("#commentload"+ID).append(html); document.getElementById("textarea"+ID).value=''; $("#textarea"+ID).focus(); } }); } return false; }); // Delete Wall Update $('.delete_update').live("click",function() { var ID = $(this).attr("id"); var dataString = 'msg_id='+ ID; var parent=$("#bar"+ID); jConfirm('Are you sure you want to delete this message?', 'Confirmation Dialog', function(r) { if(r==true) { $.ajax({ type: "POST", url: "delete_comment.php", data: dataString, cache: false, success: function(html){ $("#comment"+ID).slideUp(); } }); } return false; }); return false; }); }); </script> <style type="text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; } .update_box { background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px } a { text-decoration:none; color:#d02b55; } a:hover { text-decoration:underline; color:#d02b55; } *{margin:0;padding:0;} ol.timeline {list-style:none;font-size:1.2em;}ol.timeline li{ display:none;position:relative; }ol.timeline li:first-child{border-top:1px dashed #006699;} .delete_button { float:right; margin-right:10px; width:20px; height:20px } .cdelete_button { float:right; margin-right:10px; width:20px; height:20px } .feed_link { font-style:inherit; font-family:Georgia; font-size:13px;padding:10px; float:left; width:350px } .comment { color:#0000CC; text-decoration:underline } .delete_update { font-weight:bold; } .cdelete_update { font-weight:bold; } .post_box { height:55px;border-bottom:1px dashed #006699;background-color:#F3F3F3; width:499px;padding:.7em 0 .6em 0;line-height:1.1em; } #fullbox { margin-top:6px;margin-bottom:6px; display:none; } .comment_box { display:none;margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:50px; } .comment_load { margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:30px; font-size:12px; border-bottom:solid 1px #FFFFFF; } .text_area { width:290px; font-size:12px; height:30px; } #expand_box { margin-left:90px; margin-top:5px; margin-bottom:5px; } embed { width:200px; height:150px; } *{ margin:0px; padding:0px } ol.timeline { list-style:none } ol.timeline li { position:relative; border-bottom:1px #dedede dashed; padding:8px; } .morebox { font-weight:bold; color:#333333; text-align:center; border:solid 1px #333333; padding:8px; margin-top:8px; margin-bottom:8px; -moz-border-radius: 6px; -webkit-border-radius: 6px; } .morebox a{ color:#333333; text-decoration:none} .morebox a:hover{ color:#333333; text-decoration:none} #container{margin-left:60px; width:580px } </style> </head> <body> <?php include '../../../settings.php'; ?> <div align="center"> <table cellpadding="0" cellspacing="0" width="500px"> <tr> <td> <div align="left"> <form method="post" name="form" action=""> <table cellpadding="0" cellspacing="0" width="500px"> <tr><td align="left"><div align="left"> <h3>What are you doing?</h3></div></td></tr> <tr> <td style="padding:4px; padding-left:10px;" class="update_box"> <textarea cols="30" rows="2" style="width:480px;font-size:14px; font-weight:bold" name="content" id="content" maxlength="145" ></textarea><br /> <input type="submit" value="Update" id="v" name="submit" class="comment_button"/> </td> </tr> </table> </form> </div> <div style="height:7px"></div> <div id="flash" align="left" ></div> <ol id="update" class="timeline"> </ol> <ol class="timeline" id="updates"> <div id='old_updates'> <?php $small=mysql_query("select * from messages2 order by msg_id desc LIMIT 5"); while($r=mysql_fetch_array($small)) { $id=$r['msg_id']; $msg=$r['message']; ?> <div align="left" class="post_box"> <span style="padding:10px"><?php echo $msg.'....'.$id; ?> </span> </div> <?php //Here $id is main message msg_id value. $csql=mysql_query("select * from comments where msg_id_fk='$id' order by com_id "); $array = mysql_fetch_assoc($csql); $comment_count=mysql_num_rows($csql); if($comment_count>2) { $second_count=$comment_count-2; ?> <div class="comment_ui" id="view<?php echo $id; ?>"> <a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php echo $comment_count; ?> comments</a> </div> <?php } ?> <div id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <table width="80%"> <?php $small2=mysql_query("select * from comments where msg_id_fk='$id' order by com_id limit 2 "); while($rowsmall22=mysql_fetch_array($small2)) { $c_id=$rowsmall22['com_id']; $comments=$rowsmall22['comment']; ?> <div class="comment_actual_text"> <tr> <td style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" valign="top"> <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" align="left"> <tr> <td width="5%" style="VERTICAL-ALIGN: middle; TEXT-ALIGN: center"><img style="WIDTH: 30px; HEIGHT: 30px" alt="srinivas" src="http://www.gravatar.com/avatar.php?gravatar_id=7a9e87053519e0e7a21bb69d1deb6dfe" border="1" /></td> <td style="VERTICAL-ALIGN: top; TEXT-ALIGN: left"> <strong>Jarratt</strong> <?php echo $comments; ?> <br /><span style="COLOR: #a9a9a9">10 min ago - ID = <?php echo $c_id.'...'.$id;?> </span></td> </tr> </table><br /> </td> </tr> </div> <?php } ?> </table> </div> <?php } ?> </ol> <div id="more<?php echo $id; ?>" class="morebox"> <a href="#" class="more" style='display:block;width:100%;' id="<?php echo $id; ?>">more <?php echo $id; ?></a> </div> </div> </td> </tr> </table> </div> </body> </html> if it help here is ajax_more.php PHP Code: <?php include("../../../settings.php"); if(isSet($_POST['lastmsg'])) { $lastmsg=$_POST['lastmsg']; $lastmsg=mysql_real_escape_string($lastmsg); $small=mysql_query("select * from messages2 WHERE msg_id<'$lastmsg' order by msg_id desc LIMIT 2"); while($r=mysql_fetch_array($small)) { $id=$r['msg_id']; $msg=$r['message']; ?> <div align="left" class="post_box"> <span style="padding:10px"><?php echo $msg.'....'.$id; ?> </span> </div> <?php //Here $id is main message msg_id value. $csql=mysql_query("select * from comments where msg_id_fk='$id' order by com_id "); $array = mysql_fetch_assoc($csql); $comment_count=mysql_num_rows($csql); if($comment_count>2) { $second_count=$comment_count-2; ?> <div class="comment_ui" id="view<?php echo $id; ?>"> <a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php echo $comment_count; ?> comments</a> </div> <?php } ?> <div class="comments" id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <table width="50%"> <?php $small2=mysql_query("select * from comments where msg_id_fk='$id' order by com_id limit 2 "); while($rowsmall22=mysql_fetch_array($small2)) { $c_id=$rowsmall22['com_id']; $comments=$rowsmall22['comment']; ?> <div class="comment_actual_text"> <tr> <td style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" valign="top"> <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" align="left"> <tr> <td width="5%" style="VERTICAL-ALIGN: middle; TEXT-ALIGN: center"><img style="WIDTH: 30px; HEIGHT: 30px" alt="srinivas" src="http://www.gravatar.com/avatar.php?gravatar_id=7a9e87053519e0e7a21bb69d1deb6dfe" border="1" /></td> <td style="VERTICAL-ALIGN: top; TEXT-ALIGN: left"> <strong>Jarratt</strong> <?php echo $comments; ?> <br /><span style="COLOR: #a9a9a9">10 min ago - ID = <?php echo $c_id.'...'.$id;?> </span></td> </tr> </table><br /> </td> </tr> </div> <?php } ?> </table> </div> <?php } ?> <div id="more<?php echo $id; ?>" class="morebox"> <a href="#" class="more" style='display:block;width:100%;' id="<?php echo $id; ?>">more <?php echo $id; ?></a> </div> <?php } ?> Hi, am new to Java, Jquery and Java Script and I am finding my way through recently... I have this HTML code Code: <html:text styleClass="ui-inputText" size="12" styleId="fromDate" property="fromDate" name="HomePageForm" readonly="readonly" /> <script> initDatePicker("fromDate"); </script> I want to perform this action using JS. This will create a text-box with a calender affixed to it if used in Plain HTML... This is the initdatepicker function Code: function initDatePicker(dateFieldId){ var format = '<%=ctx.getDateFormat()%>'; if (format == "yyyy-MM-dd"){ format= "yy-mm-dd"; }else if (format == "MM/dd/yyyy"){ format= "mm/dd/yy"; }else if (format == "dd-MMM-yyyy"){ format= "dd-M-yy" } $("#"+dateFieldId).datepicker({ showOn: 'button', buttonImage: 'include/images/icons/calendar.png', buttonImageOnly: true, changeMonth: false, changeYear: false, buttonText: 'Select date' , dateFormat: format }); } I have done a few things, but, could not get the result I need... Code: cellIndex++; var cellObj=$('#genericRules tr:eq('+index+') td:eq('+cellIndex+')'); cellObj.html(''); var table = document.getElementById("genericRules"); var rowElem = table.rows[index]; var cell = rowElem.insertCell(3); var txtInp = getTextField(indexName,index,'8'); cell.appendChild(txtInp); var dateImg = getImage(index); cell.appendChild(dateImg); cell.align="center"; initDatePicker(indexName + '['+index+'].'+name+'from'); function getTextField(indexName, index, size) { //, maxlength var txtInp = document.createElement('input'); txtInp.setAttribute('type', 'text'); txtInp.setAttribute('class', 'ui-inputText'); txtInp.setAttribute('indexed', 'true'); txtInp.setAttribute('name', indexName + '['+index+'].'+name+'from'); txtInp.setAttribute('id', indexName + '['+index+'].'+name+'from'); txtInp.setAttribute('size',size); txtInp.className = "ui-inputText"; txtInp.name=indexName+'['+index+'].'+name; txtInp.indexed ='true'; return txtInp; } function getImage(index){ var image = document.createElement("img"); image.src = "<%=request.getContextPath()%>/include/images/icons/calendar.png"; image.setAttribute('class', 'inputCalendar'); image.className = "inputCalendar"; image.name = "imgDatevalue"+index; image.id = "imgDatevalue"+index; return image; } My application is now showing me the image but, am not able to get the calender when i click on it.. I need help on this thing... Please try to provide me with soem intel... Dear All, On my HTML page, I am trying to use as a snippet the script for automatic currency conversion. It is well known that exchange rates between currency are being changed very often (most of times even daily) and I don't want to republish either page with script or entire website every time the exchange rate changes. For website design I am using xsitepro software because I don't know programming. So what I would like to have on specific page of website is something similar to table (if anyone has any better recommendation than using a table, please share). In this table I would like to state prices of my services. Primary currency is only one. So in this column, the numbers shouldn't be changed unless I want to change the prices (and of course therefore republish the website, no need to republish sitemap). In the rest of the columns the numbers should be changed immediately, without needing to republish anything (thats the point of the script) and also rounded to each 5. What I mean with ''each 5'' is shown on few of the following random chosen examples (1500): 1500.03 is rounded to 1500 1500.30 is rounded to 1500 1500.50 is rounded to 1500 1502.49 is rounded to 1500 1502.50 is rounded to 1505 (!) 1504.99 is rounded to 1505 1505.01 is rounded to 1505 1507.49 is rounded to 1505 1507.50 is rounded to 1510 and so on. Idea is to prevent from getting coins. So the break point is on 2.50, 7.50, 12.50, 17.50, 22.50, 27.50 and so on. Not sure how to mathematically describe this. Hopefully I was understandable. I want to have in the columns only the currencies that I am willing to accept if potential client cannot change the currency to my primary one (given in second most left column) in his local exchange office. But I repeat that what Im trying to do is having automatically and immediately updated numerical values on particular HTML page based on most recent exchange rates (of course trustful source is needed). Since I don't know programming, I did some research on google and discovered this: http://coinmill.com/webmaster_options.html The downer script on the right side looks ok but its not even close to what I need due to five reasons: - it is being converted outside the table - with such way i cannot clearly show which currency is primary (prefered) one - conversion is being done to only one other currency at the same time - no rounding to ''each 5'' - unknown source (and therefore untrustful one) of updating most recent exchange rates Table such as this one: http://www.x-rates.com/ looks great but still not meeting my requirements. I would like to replace flags in the left column with ''service 1'', ''service 2'', ''product 1'' etc. Also I have no idea how rounding could be done. So at the end I would end up with something like (here Im showing only two ''still willing to accept'' currencies just to show an example): Currency:Euro Currency:American Dollar Currency:Japanese Yen Service1 500 670 51535 Service2 400 535 41228 Service3 200 265 20614 Top left corner as it is on x-rates.com would be even better. note: when I previewed my post before submitting, I noticed that the forum doesn't let me make so much spaces but I think those numbers are still understandable where do they belong. Any help would be muuuuuch appricated Hi all, First of all thanks for everyone who responds to me. I appreciate it. Here is my problem. I have a HTML form containing two text box controls in it and a submit button. When a user enters information in those two textboxes and click on submit, the information is sent to a function in Javascript. In the javascript, the information from those textboxes is stored in a javascript variable. The problem is as follows: When I am inputting string text in the html text boxes and in the javascript when I am trying to print those values, it is giving me out an error saying NaN. However when i input integer values in the text boxes it is printing those numbers. Is there a conversion that I have to do for the string to be printed. I am new to Javascript and need your help. This is a basic code of Javascript. Below is the code that I have. Thanks in advance for your help. <html> <script type = "text/javascript"> function square(form) { var test = form.value1.value; window.alert(+test); var point = document.test.value1.value; pointcon = point.toString(); window.alert("nice"); window.alert(+pointcon); var point2 = eval(document.test.value2.value); var point3 = point + point2; alert(point3); } </script> <head> <body> <form name = "test"> First name: <input type="text" name = "value1" value1 = ""/><br /> Last name: <input type="text" name = "value2" value2 = ""/> <input type = "button" value = "Submit" onClick="square(this.form)"/> </form> </body> </html> I am trying to fix a problem that I have with my JavaScript assignment for class. The code I have so far is beneath. I ran FireBug on it, and came back with "missing ) after argument list on Line 24" Code: <SCRIPT LANGUAGE="JavaScript"> function Convert(){ // declare a variable var c var f // get variable's value f = parseFloat(document.getElementById('c').1.8 * c + 32) } </SCRIPT> Code: <FORM NAME="Assignment5"> <B>Instructions: </B> Input the temperature in degrees Centegrade and click "Convert" to convert the temperature from degrees Centegrade to degrees Farenheit.. <BR> <BR> <B>Input Values: </B> <BR> <B>Degrees <I>Celsius</I>:</B> <INPUT ID="c"> <BR><BR> <INPUT TYPE="Button" VALUE="Convert" OnClick="Convert();"> <BR><BR> <B>Output Value: </B> <BR> <B>Degrees <I>Farenheit</I>:</B> <INPUT ID="f"> </FORM> Thanks in advance for the help! Hi, Please bear with me as I have zero knowledge of programming, or even if this is the right way to do this. I use a website that has (i believe) Javascript on that uses some maths, and I am looking to convert this webpage into excel... I wonder if someone could give me a pointer to convert the attached code into the excel format, or even just to highlight where the maths is so i can continue myself! Code: script is too long, so ive attached as a zip I would like to compare dates in the format used in twitter, which is this: Wed Apr 08 14:30:10 +0000 2009 How do I do this? Do I need to convert to a timestamp first, and if so, how do I do this? G Hey everyone, I have a slight problem with my program and am in need of some help. I am writing a program that will take user input and convert the 8 digits the user enters (the 0's and 1's) and converts them into an integer between 0 and 255. It is a very simple program but I am still having some errors :/ If anyone could take a look at the program and get back to me, it would be very helpful! Code: import javax.swing.*; public class BinaryToInteger { static String userInput = JOptionPane.showInputDialog("Enter a binary number with 8 integers to convert."); //Dialog Box that asks for user input static int binaryValue = Integer.parseInt(userInput); //Parses the user's input into an integer public static void convert() //Method to convert the user's input into a number { char firstNumber = userInput.charAt(0); //Reads the eight numbers the user enters char secondNumber = userInput.charAt(1); char thirdNumber = userInput.charAt(2); char fourthNumber = userInput.charAt(3); char fifthNumber = userInput.charAt(4); char sixthNumber = userInput.charAt(5); char seventhNumber = userInput.charAt(6); char eigthNumber = userInput.charAt(7); System.out.print(firstNumber); //Just to check to see if the correct numbers are being read from the JOptionPane System.out.print(secondNumber); System.out.print(thirdNumber); System.out.print(fourthNumber); System.out.print(fifthNumber); System.out.print(sixthNumber); System.out.print(seventhNumber); System.out.println(eigthNumber); int finalNumber = 0; //Initializing "finalNumber" if(firstNumber == 1) //Checking to see if "firstNumber" is equal to 1 then add 128 to "finalNumber" if it is, and do nothing if it is not { //The same applies below finalNumber = finalNumber + 128; } else { } if(secondNumber == 1) { finalNumber = finalNumber + 64; } else { } if(thirdNumber == 1) { finalNumber = finalNumber + 32; } else { } if(fourthNumber == 1) { finalNumber = finalNumber + 16; } else { } if(fifthNumber == 1) { finalNumber = finalNumber + 8; } else { } if(sixthNumber == 1) { finalNumber = finalNumber + 4; } else { } if(seventhNumber == 1) { finalNumber = finalNumber + 2; } else { } if(eigthNumber == 1) { finalNumber = finalNumber + 1; } else { } System.out.print(finalNumber); //Just to see what the compiler spit out as the answer } public static void main(String []args) //Main method that runs the convert() method { convert(); } } I wrote this microday clock some time ago (with some difficulty) as a project, and now I'm attemtping to make an octal version. I'm still learning JavaScript, so I'm not sure exactly which line/s to edit and what script to add to make it fuctional. if anyone here can show me the most concise script needed to convert the output of this JavaClock from decimal to octal it would be very much appreciated the original script to be converted is shown below : ------------------------------------------------------------ Code: <HTML> <HEAD> <META NAME="JAVACLOCK"> <META HTTP=EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="microday clock" INDEX="all"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <STYLE> BODY { font-family: Digital Readout Expanded; } </STYLE> <TITLE>microday clock</TITLE> </HEAD> <BODY BGCOLOR=BLACK TEXT=BLUE ALIGN=CENTER LINK=ROYALBLUE VLINK=VIOLET> <DIV ALIGN=CENTER> <span id="clock"> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function Clock() { Now = new Date(); var DecTime = Now.getTime()/86400000 + 1004472; DecTime = '<FONT SIZE=5><FONT COLOR="#3399FF">' + DecTime.toString().substring(1,4) + ' ' + DecTime.toString().substring(4,7) + '</FONT> <FONT COLOR="#33CC00">' + DecTime.toString().substring(8,11) + ' ' + DecTime.toString().substring(11,14) + '</FONT>' if (document.all) document.all.clock.innerHTML=DecTime else if (document.getElementById) document.getElementById("clock").innerHTML=DecTime else document.write(DecTime) } if (!document.all&&!document.getElementById) Clock() function Increment() { if (document.all||document.getElementById) setInterval("Clock()",86) } window.onload=Increment // End --> </script> </span> Hello everyone, 'recently converted an excel timesheet to a PDF form. Trying to get some help to convert two excel formulas (formulae?) into javascript. First Excel formula is intended to return the value of "40" if the total is above 40, otherwise display actual value: =IF(L17>40, 40,L17) Second excel formula is the "overtime" field, which displays the number of hrs above 40hrs, or displays "N/A" if below 40: =IF(L17>40, L17-40, "N/A") I have essentially no experience in Javascript and I am trying to learn, but any help to get me over this hump will be appreciated. Regards tim Hi All, In javascript is it possible to convert a long number (as hex string) to a float number ? Ex. 40 A0 00 D2 is 5.0001 and reverse I know I can use math functions, then seperate out Sign/mantissa/exponent and then convert it in float, but their must be some easy alternative. Can I use sprintf, is yes how can I use this? Thansk for your help! Regards Max I'm currently constructing a javascript "terminal" on a site I'm building so that I can test objects and functions outside of the web developer terminal in google chrome. Given that I have active javascript defining an object called item, typing item in the chrome terminal returns Object and goes on to list the properties of item. Moreover, I can define a function in the terminal like this: function(x) { return x }, and then function(item) will return Object and list the properties. However, if I use form data and user input in the place of the argument, the datatype becomes a string and not an object, so typing item in the form and clicking a button that performs function(document.form.text.value) returns the string item and not Object. Is there any way to convert this primitive string to an object so that I can then iterate through properties, and so on? I have a class assignment that involves finding a simple recipe, and creating a unit conversion using JavaScript that tells me the exact unit of each item required to make x amount of servings. I have this so far, and every time I try to convert the units, the new units are the exact same as the original units. Please help! Code: <HTML> <HEAD> <TITLE>COMSC-100-1241 - Assignment #7 - Your Own Recipe Conversion Program</TITLE> <SCRIPT LANGUAGE="JavaScript"> function Convert(){ // Assign Variables servingsBase = parseFloat(document.getElementById("servingsBase").value); servingsNeeded = parseFloat(document.getElementById("servingsNeeded").value); var amount1 = parseFloat(document.getElementById("item1").value); document.getElementById("amount1").value = amount1 / servingsBase * servingsNeeded; var amount2 = parseFloat(document.getElementById("item2").value); document.getElementById("amount2").value = amount2 / servingsBase * servingsNeeded; var amount3 = parseFloat(document.getElementById("item3").value); document.getElementById("amount3").value = amount3 / servingsBase * servingsNeeded; } </SCRIPT> </HEAD> <BODY> <TABLE BORDER="1" WIDTH="700" ALIGN="center"> <TR> <TD> <DIV ALIGN="left"> <DIV ALIGN="center"> <B>BRIE BRUSCHETTA</B> <BR> <B>Recipe Website:</B> <A HREF="http://busycooks.about.com/od/appetizerrecipe1/r/briebruschetta.htm" TARGET="_blank">http://busycooks.about.com/od/appetizerrecipe1/r/briebruschetta.htm</A> </DIV> <BR> <B>Directions: </B> <OL> <LI>Under broiler or on grill, toast one side of the french bread slices. <LI>Turn slices over. <LI>Brush the untoasted side with some of the juices that result when you chop the tomatoes. <LI>Layer slices of brie on the bread. <LI>Return to broiler or grill and toast 2-3 minutes, until cheese is melted. <LI>Top with the chopped cold tomatoes and sprinkle with salt and pepper. Serve immediately! </OL> <BR> <B>Ingredients: </B> <UL> <LI>12 Slices of French Bread <LI>6 Ripe Tomatoes (chopped) <LI>8 Ounces of Brie Cheese (thinly sliced) </UL> <B>Prep Time: </B> 15 minutes <BR> <B>Cook Time: </B> 5 minutes <BR> <B>Total Time: </B> 20 minutes <BR> <B>Yield: </B> 4 servings </DIV> </TD> </TR> </TABLE> <BR> <TABLE BORDER="0" WIDTH="550" ALIGN="center"> <TR COLSPAN="4"> <DIV ALIGN="center"> <B><U>Recipe Converter</U></B> </DIV> </TR> <TR> <TD WIDTH="300"> <B>First Ingredient & Unit</B> </TD> <TD WIDTH="100"> <INPUT TYPE="text" ID="item1" VALUE="French Bread, slices"> </TD> <TD WIDTH="50"> <B>Amount: </B> </TD> <TD WIDTH="100"> <INPUT TYPE="text" ID="amount1"> </TD> </TR> <TR> <TD WIDTH="300"> <B>Second Ingredient & Unit</B> </TD> <TD WIDTH="100"> <INPUT TYPE="text" ID="item2" NAME="item2" VALUE="Tomatoes, each"> </TD> <TD WIDTH="50"> <B>Amount: </B> </TD> <TD WIDTH="100"> <INPUT TYPE="text" ID="amount2"> </TD> </TR> <TR> <TD WIDTH="300"> <B>Third Ingredient & Unit</B> </TD> <TD WIDTH="100"> <INPUT TYPE="text" ID="item3" NAME="item3" VALUE="Brie Cheese, ounces"> </TD> <TD WIDTH="50"> <B>Amount: </B> </TD> <TD WIDTH="100"> <INPUT TYPE="text" ID="amount3"> </TD> </TR> <TR> <TD COLSPAN="2"> <B>Recipe Makes This Many Servings: </B> </TD> <TD COLSPAN="2"> <INPUT TYPE="text" ID="servingsBase" NAME="servingsBase"> </TD> </TR> <TR> <TD COLSPAN="2"> <B>I Want To Make This Many Servings: </B> </TD> <TD COLSPAN="2"> <INPUT TYPE="text" ID="servingsNeeded" NAME="servingsNeeded"> </TD> </TR> <TR> <TD COLSPAN="4"> <DIV ALIGN="center"> <INPUT TYPE="Button" VALUE="Convert" OnClick="javascript:Convert();"> </DIV> </TD> </TR> </TABLE> </BODY> </HTML> |