Condition Insertion

Jul 23, 2005

Is it possible to make a file insertion conditional? I now have the code:

'<script type="text/javascript" src="http://www.site.com/showit.js">'

And I wondered if it is possible to make this conditional, something like:
if (mycondition==true) include('http://www.site.com/showit.js');

View 4 Replies


ADVERTISEMENT

Insertion Into Textarea

Jun 11, 2007

I have a button next to a textarea when they click that button it launchs another window. Now I need another button that will take a value (it will be an html code) close that window, and put that value in the textarea.

Sort of like how when you click the link button in this wysiwyg editor it pops up a window that asks for some stuff and then inserts it here.

View 2 Replies View Related

TinyMCE / DOM / JS - HTML Insertion?

Apr 11, 2009

Essentially, I am building an image upload plugin, and what the image inserted automatically at the end of the process, so I thought I would put this at the end of the script:

Code:
<script type="text/javascript">
tinyMCEPopup.execCommand('mceInsertRawHTML/mceInsertContent', false, '<?= $image_tinymce_safe ?>');
tinyMCEPopup.close();[code]....

If that is run, then the actual image appears in the editors instance. Is this a general JS / DOM issue (I got it to work with the original script before, I just stupidly overwrote the file!), or, is it something more?

View 1 Replies View Related

Dynamic Insertion And Execution Of JavaScript

Apr 20, 2006

I'm developing a webpage that is composed by several divs. These divs
are supplied by the server depending on the user that made the request.
Some of these divs require some javascript functions to be called when
they are added to the page. I add the content using innerHTML (function
renderPage(data) ....

View 3 Replies View Related

JQuery :: Speed Up Dom Insertion When Used With Data()

Feb 2, 2010

Suppose I want to populate a drop down ajaxly. The population is written like:

var $select = $("#target");
$.each(datas, function(){
$("<option/>")
.val(thia.value).html(this.name)
.appendTo($select)
.data('srcData', this);
});

But the speed is considerably slow when the datas is large. I know that I can use just string concatenation and html() finally to speed it up but what can I do with the data()?

View 10 Replies View Related

FF Automatic Curly Brace Insertion?

Jan 6, 2006

javascript:alert(function(){if(window) return;})

becomes:

function(){
if(window){
return;
}
}

View 4 Replies View Related

Displaying The Date In Mysql Format For Insertion Into Db

Jun 13, 2006

ive need to format the date (variable "tomorrow") in this form to mysql
format yyyy-mm-dd can anyone please show me how to amend my script?

<script language="javascript">

function showDate(thisObj){
/* create a Date object using the system clock */
today=new Date();
td = today.getDate();
tm = today.getMonth();
ty = today.getFullYear();
tomorrow=new Date(ty,tm,td+1)

/* convert contents to string and place in control */
document.getElementById(thisObj).value=tomorrow;
}

</script>
<body onLoad="showDate('date');">

<input id="date" type="text" readonly="readonly" />

</body>

View 1 Replies View Related

JQuery :: Finding Non-Predetermined DOM Insertion Point?

May 12, 2010

How can jQuery locate a non-predetermined DOM insertion point? My application relies on custom code to "bootstrap" itself. I'm wondering if similar functionality is available in jQuery?

My app works in the following fashion:
- user places a script tag in their web page.
- my script fires and performs the following routines:
- scriptLocation = whereAmI()? (find scripts in document, length -1)
- insertBefore(DIV, scriptLocation);
- use DIV as canvas, DOM target for all that follows
- install application in DIV

Note that my custom app does not wait for any kind of "ready" state. It has no dependencies on the surrounding document. It fires inline. My impression is that jQuery's approach ("Find something, do something") is incompatible, because it relies on a known DOM insertion point. It would seem straightforward to "query" the DOM, and find an element of known ID. That would conflict with my business constraint; I have no control over the destination page. Are my assumptions about jQuery true? Or is there a way for a jQuery script to wake up, find its location, and the install elements there?

View 5 Replies View Related

Automatic Webpage Refesh After Data Insertion

Mar 23, 2009

I am stuck with an issue in my project from completion. My program is trading exoeriment with 2 groups. If any user in 1 group enters value in filed called askvalue, this value must must be updtaed to all other users in the group. I tried to do thi by inserting and updating the table. Values are updating correctly in table a but weppage s not being regfeshes to other traders in same group.

I am posting my code here:

When any user in the group clicks this button insertion sql statements have to executed and then refesh the webpage for all the traders in the same group without clicking refresh.

View 1 Replies View Related

WYSIWYG - Self Insertion - Create An Iframe With DesignMode On To Enable Editing Of The Frame

Aug 5, 2009

I am trying to create a WYSIWYG editor for my site, but seeing as how every browser gives different results when using the execcommand method, I am trying to do my own insertions instead.

What I would like to do is create an iframe with designMode On to enable editing of the frame, but when someone does a command to bold text, I want to make a method which enters <b>Some Highlighted Text</b> into the frame where the user highlighted so it would appear bold and the source would have the <b> tags.

My issue is I have been unsuccessful in learning how to take the selected text within an iframe and surround it with tags. I was able to accomplish this in Internet Explorer using this code:

Except the resulting text would actually have the <i> tags appear, and the source would be:

Pretty retarded if you ask me since in no way did I want it to convert the tags into entities.

Anyway, if anyone could please direct me to a method in which I can successfully take selected text within the iframe and surround it with HTML tags in such a way that the formatting will actually show.

View 4 Replies View Related

Ajax :: Refresh Div - Content Consists Of An Image That Will Change On Insertion Of A Row To SQL Database

Oct 16, 2010

I have got a DIV that I need to refresh, its content consists of an image that will change on the insertion of a row to the SQL Database, however, when I use a refresh on my div it does refresh but does not change the image...

My refresh code is ajax:

And my PHP code contains the MYSQL that has a mysql_num_rows, so that PHP can see if there are rows or not.

I would like my page not to redirect or refresh on my div change.. So I would just like my div to refresh.

View 1 Replies View Related

Image Insertion Page That Is Part Of A JS WYSIWYG - Put Caption Bar After The Image In The Main Code?

Nov 27, 2011

I have an image insertion page that is part of a JS WYSIWYG. It works okay, but I would like to add a styled caption bar underneath it.

This is what I'm currently using for the caption (inserted by a button):

Code:

This is the code from the insert image page:

Code:

How do I put the caption bar after the image in the main code?

View 1 Replies View Related

Get A Value If A Condition Is Filled

Jul 23, 2005

if (form.interface_template.options.length > 0) {
template =
form.interface_template.options[form.interface_template.selectedIndex].value

} else {
template = ''
}

View 4 Replies View Related

If / Then / Else Help Needed - More Then One Condition Possible?

Sep 19, 2006

I want to write an if / then statement and have tried using this:

var MyVarMailto;
if (Request.Form("LoanRequest") == "Under $250,000") {
if (Request.Form("Organization") == "1") {
MyVarMailto = "emailA@address.com";
}
}
else if (Request.Form("LoanRequest") == "Over $250,000") {
if (Request.Form("Organization") == "1") {
MyVarMailto = "emailB@address.com";
}
}
else {
MyVarMailto = "emailC@address.com";
}

So basically I have a form that gets filled out and submitted which
passes the values to this page. I want to check the values against
conditions that you can probably figure out above and then set the
variable contigent to those values. I tried using AND after the first
condition but that doesn't do anything.

View 14 Replies View Related

Put If Condition In Function ?

Apr 26, 2011

I have an table in which an select box like this:

Following have an option in OS: windows/Linux. i only want when user select OS - linux ... then function call otherwise if user select OS - window ... no need to call this function validate() i think it requires if condition in function Validate().... how it is posible to put if condition in function validate()

View 1 Replies View Related

How To Add 1 Condition To Script.?

Nov 30, 2006

Currently have a txt input with default value="Your Name". with the on focus event to clear default text.

However if a user doesn't touch the txt box the the script goes on to validate the email box below because we have "Your Name" loaded up. and that passes validation below.

How do I go about adding another condition to look for string "Your Name" to the following if statement.

I tried adding another "||" statement after value.length <2 part and got nowhere.

function checkmailform(){
if ( (document.forms.newsletterform.Name.value == null) || (document.forms.newsletterform.Name.value.length < 2) ) {alert("Input First NewsName");
document.forms.newsletterform.Name.focus();
return false;
}else{...

View 4 Replies View Related

Elseif Condition?

Apr 27, 2002

Is there a way in javascript to use multiple if conditions? For example I need something like this: Code:

if( email=="" )
{
do something
}
elseif( !issemail(email) )
{
do something else
}

I know it would be possible to use else and then another if but since this javascript code is PHP-generated and I'd have about 5 conditions, I can't really do this easily.

View 10 Replies View Related

XMLHttpRequest() Completion Condition?

Dec 12, 2005

I came across something I'm unfamiliar with -- there's an added check for window.location.href.indexOf("http")==-1 to see if the XMLHttpRequest send() completed, i.e.,

if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))

Does anyone know why this is done or which browser this (kludge?) is meant for?

View 3 Replies View Related

Reating Checkboxes With Condition.

Nov 7, 2006

I created two forms. In the first frame i had Items with checkbox like
names of students etc. When ever i checked on any name It's display on
the other frame. Up to know it's fine. But when i deselcted any check
box it again display same name.

My requirement is when i deselected the checkbox that particular
student name is deleted from the list .

View 6 Replies View Related

JQuery :: Use OR Condition For Validation?

Jan 5, 2012

I am using jquery.validate.js for validating the forms.

The issue now is I have a dropdown list with values. Say a dropdown has the values 'One', 'two', 'Three', 'Four','Five'.

If the value is 'Three' OR 'Four' . The next 2 input fields are required. Else those are not required. The value will be seperated with optgroups.

I tried with different options but I couldnt find the solution. How to validate this?[code]...

View 1 Replies View Related

JQuery :: If Condition Is Not Working

Aug 10, 2011

Here is my code

[Code]

But if Condition is not working...

View 2 Replies View Related

Two Not Equal Comparisons In An OR Condition?

Nov 5, 2009

Could anyone tell me (or link me to some place that can) why the following if-statement will execute?

if (5!=6 || 7!=8) {
alert("Why does this work?");
}

View 2 Replies View Related

Condition Depending On Screen Rs / What To Do?

May 16, 2010

I m crearting a pop with some parameters like locationbar,statusbar=no and its height and width 1280*800. but originally i have given its hight to be 699 to pixel a viewpoint.. can i put some if condition. checking if the resolution isn't at 1280 * 800 and if so than the popup should have scroll. is there anymore smater way to handle this? as of now if someone has a less Res. everything get clipped off

View 4 Replies View Related

Condition And Element.style...?

Aug 17, 2007

i am trying to have text-decoration applied on some text depending on the value of certain variable. If the value of myvar=0 text-deco =none and if it's 1 then text deco= line-trough...

Kind of the same thing that emails web apps like yahoo or gmail do with mails read or unread if it's unread then email title/subject is bold/strong but if it's read then email title is in normal font-weight...

here is some piece of code i have written to do that

the text on which i want to apply the conditionnal decoration is a table cell (cell2DisplayCell1), the text itself is inserted by the innerHTML instruction!

I tried to introduce the conditional statement with a function displaylinksLineThrough() which is defined in the second block code... Code:

View 2 Replies View Related

Global Variable Only If A Condition Is Met

Aug 2, 2010

I wish to declare a global variable, but only if a certain condition is met. For example:

Code:

Except that now it is not global because it is contained within an if statement.

View 3 Replies View Related

JQuery :: Code Always Going Into Error Condition

Jul 7, 2011

Following is the code.

On click event it always goes into errorfunctionwith status "undefined".

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved