ryantroop 177 Practically a Master Poster

/* also, read the edit */
So... after painful MySQLi intro to working with MySQL Stored procedures... I have come to the conclusion that the only good way to pass variable length binds is to use eval()

Is this a poor choice? The way I am using it is:

$Conn = new mysqli("", "", "", ""); //foo in the blanks...
$Res = $Conn->prepare("") //call whatever(?,?); //in this case, 2

$Arr = array("i"=>2, "s"=>"age"); //we make/get an assoc array with type=>value of whatever length...
$Types = "";
$Args = array();
foreach ($arr as $k=>$v)
{
    $Types .= $k; //all our types as a string
    array_push($Args, $v); //all our values easily iterable...
};

$cString = '$Res->bind_param(\'' . $Types .'\', ';
foreach ($Args as $k=>$v)
  $cString .= '$' . $v . ', ';

$cString = substr($cString, 0, -2);
$cString .= ');';

eval ($cString);

//from here, we execute, etc... 
//and then reverse the process via...

foreach ($Args as $k=>$v)
    eval ('return $' . $v .';');

//and plop those into "real" variables...

Of course, this is NOT complete by any means, but I'm curious if there is a "better way" than this that does not require PHP version sniffing, or goofy attempts to pass an array by reference that throws weird deprication warnings which turn into errors if omitted...

Granted.. being on GoDaddy's servers makes most PHP programming a pain, but if this is it then it's what I gotta do... any thoughts?

Thanks,

Ryan

edit:

obviously the fatal flaw of this is …

ryantroop 177 Practically a Master Poster

heh.. Im guessing your problem starts on line 31 and ends on line 65...

why are you doing a self-executing function before the window has loaded? I get it's top down, but you're defining and running code as it's being read. You're not getting very much speed boost by doing this.

Line 40, you are using an HTML collection, who has an index that starts at 0, but you go to <= of the collection's length (therefore, you are 1 higher than existing -> this makes an error on line 41 because tab[i] does not exist, so getting a property of tab[i] would result in failure because you cannot get a property of undefined).

Lastly, and I could be wrong about this... but meh, Ill toss it out as theory... since you are self-executing and not naming the function (it is anonymous), you are making functions that are not in the window scope implicitly (which makes them single run). So, you may be trying to execute code that doesn't really exist. Even if you were to name the function (function foo() { })(); you still may come across the problem of being out of scope. -- edit: Especially on line 62, where "this" most definately does not refer to the window or any given element on the page, but instead the anonymous function (I am 99% sure of this...). Instead, you should be passing in the event, and get the source element of the event, but doing that through an …

ryantroop 177 Practically a Master Poster

Im pretty sure this is what you are looking for...

http://www.microsoft.com/en-us/download/details.aspx?id=36843

This will allow T-SQL editing, and allow you to hook up and browse a database.

If youre trying to connect to a MySQL server, you will need to download the mysql tools, but the TSQL editor does not work in VS for MySQL. Instead, I recommend MySQL Workbench.

http://dev.mysql.com/downloads/tools/workbench/

Hope that helps,

Ryan

ryantroop 177 Practically a Master Poster

I work in a microsoft shop, and I can't sing praises for visual studio express enough. Some people don't like it, but it's super simple in my humble opinion.

As for books... html and css is pretty repetitive... so the books you got are getting you in the right direction.

Going through the w3schools tutorials are never a bad thing, and simply trying things on your own and seeing if you "can" do it because you're interested in it will go a long long way.

The wonderful part of personal code that you are learning from is that if you break it:

1) no one is likely to see it
2) you can try goofy stuff without fear of "breaking" something other than layout/colors/etc...
3) if you are truly interested in it, you will learn and grow.
4) you will beging to know what questions to ask, and by reading though forums like DaniWeb you will understand what everyone is talking about.

I read through answered questions all the time just to see solutions and see if it's something I had never thought of, or just to see if I was spot on with how I would have handled the same situation.

Books are fine for starting and getting a general idea. Doing, practicing, and owning your own code will help you develop your skills and become comfortable enough to rarely look at a book ever again (and instead, learn to google it like the rest of …

ryantroop 177 Practically a Master Poster

My take in a nut shell:

There are certain camps in programming -- those who like complete control, and those who don't mind trusting others to do some of the annoying work.

C/C++ --> Meant to be compiled. You are forced to do memory management. It runs very close to the hardware level, which means it doesn't have a whole lot of overhead when executing. In general, web sites wont use it unless it's a web service or custom server that uses C/C++ as a back end (which is what PHP was meant to do).

JAVA/C# --> Memory management done for you. After that, JAVA requires a VM to run, and has a lot of other issues that programmers tend to dislike. It's also not very secure. C# is very closely tied to Microsoft, so some people dislike it for that alone (and .NET). They are used to develop anything from stand alone apps to web tools, though it's not commonly front-facing any longer (JAVA used to be, but I haven't seen it on the web in a while, now...)

Perl --> I don't know much about it other than I don't want to learn it because that means I have to read it. It's old.

PHP --> Dynamic web scripting / software development. In its current state, it can tackle just about everything from socket programming to massive data management. While it can be compiled, it's generally not used in such a manner. It's a server side web programming …

ryantroop 177 Practically a Master Poster

You have a few options...

In your content area you can have your pages pre-populated in container divs with an ID and set to display:none. Then, with selections you "unhide" them, and hide the other(s). You could even keep a global to know which one you are on...

Alternatively, you can do a synchronous ajax call to a server page and set the innerHTML of the content area.

I would encourage you do not do this. Hiding all content and having it only displayable through JScript is a bit of a no-no... though JScript is so pervasive and common that it's unlikely you will come across anyone with scripting turned off/etc... but it's still good practice to not have your script intrude on your content...

I would also encourage you to not do this in a single "superfunction" and catch it all in a switch.
You could do a switch, but allow the switch to call helper functions (or even a helper function that passes in a variable... which you could simply do to bypass the switch all together...).

ryantroop 177 Practically a Master Poster

Yes, it's simple if you are only targetting CSS3 compatable browsers, which IE9 is definitely not :-/

Soon, transitions will become common place, but not until windows 7 has gone byebye.. in an age where XP is still extremely common, it may be some time.

If you have this as part of your core functionality, Im afraid many would consider the site unusable if they do not have a compatible browser.

Granted, that's mainly IE users - but that's also likely to be a large portion of your potential user base...

<M/> commented: ;) +8
ryantroop 177 Practically a Master Poster

Im not sure how the generic buttons work, but you could put a "disabled" class (or attribute if it's an actual submit button) on the button, and wait for your callback to determine what happened...

Im not sure that's even a possibility for you...

You could do something like...

var page = window.open(paypalurl);
disableClickFunction(); //change it's class, click handler, etc...
page.onbeforeunload = allowClickFunction; //set class/click handler/etc.. back to original state.

Again, Im not sure if you will be able to keep reference to the child window since it's cross domain... but it's worth a shot?

ryantroop 177 Practically a Master Poster

what format? I believe wp supports mp3 for streaming audio, not ogg :-/ may be a place to start.

ryantroop 177 Practically a Master Poster

it would be dependent on a few things.. what is the query you are using for the retrieve? Are you doing some funky joins or parsing?

Also, how are you doing the call to the data? Are you processing before or after the query for anything? How are you iterating? How are you displaying? JS? PHP? It's all really dependent on your setup and code...

ryantroop 177 Practically a Master Poster

I think the way I would handle that is through some sort of extrapolation... the flv would have to keep track of it's own coordinates (which shouldnt be hard), which would then be added to the offsetTop and offsetLeft of the flv element or container (again, not too hard) which can then be passed into your java applet (or however that works)...

I can't think of any other ways...

ryantroop 177 Practically a Master Poster

you have a series of ids that do not have quotes... for example:

line 54:

<tr><td>Name:</td><td><input id=cust onfocus="if(this.value=='Name'){this.value='';}" value="Name"></td></tr>

id=cust --> id="cust"

You have tons of these.. fix your quotes, you will probably fix your issue.

Also, I recommend, for readability and so youre not inlining a ton of if checks...

function checkVal(element, string)
{
  if (element.value == string)
    element.value = "";
}

then the line above would be:
<tr><td>Name:</td><td><input id="cust" onfocus="checkVal(this, 'Name');" value="Name"></td></tr>

ryantroop 177 Practically a Master Poster

a table cell is like any other block element in regards to what you are talking about... I think..

Just like you would set the innerHTML of a div or span, you can set the innerHTML of a table cell (<td>);
Alternatively (and some would argue more correctly) you could get a table cell by id and append a text node with a value...

If I am totally off base for what you are asking, maybe give a little more clarification?

ryantroop 177 Practically a Master Poster

Im not sure I follow what you are trying to do... are you trying to add to a file?

If you are adding to a file, you have to fwrite first, then fread to get the data back out.

In your example, I think that you are going to echo a boolean (true/false) as to whether or not the fwrite performed successfully...

ryantroop 177 Practically a Master Poster

:-/

assuming you have connected to the database correctly...

$result = mysql_query("select * from table1 where id=$_POST[ID]");
while ($data = mysql_fetch_array($result))
{
    foreach($data as $k=>$v)
        echo ($k . " = " . $v);
}

or.. something to that effect... but since we are all moving to mysqli, this is already horridly outdated.

Check out http://www.php.net/manual/en/mysqli.quickstart.statements.php

To expand...

When you query with php, you are asking for a "result" object (or, to be syntactically correct, a resource). You then need to iterate through the object/array/resource/whatever in order to actually get your data.

ryantroop 177 Practically a Master Poster

If my cursory google glance has served me well, least requires more than 1 input to function properly...

Is your result returning multiple rows? If not, least may not be what you are looking for, but floor() maybe?

iamthwee commented: disagree -3
ryantroop 177 Practically a Master Poster

There is no single answer for this...

It all depends on what you are doing...

If you are making a web-app that is hosted on the device: use JAVA for android, but you will then need to port over to iOS and C/C#

If you are doing a web-app, performance wise php/asp will probably be around the same, depending on the host. I would argue a slight edge to PHP over ASP. JAVA would, in my experience and opinion, be very slow for this application.

PHP requires that you know security on your own, and know how to interact with other technologies. It is fragile if built fragile, but very very powerful and secure if you know how to keep it that way.

I would assume the same for ASP, I am not too familliar with it other than it is proprietary from MicroSoft (or was... or something?)

JAVA takes a lot of the guess work about keeping things secure "out" but would require a few basic security measures, such as escaping strings for databases, etc...

All in all, the answer comes down to... it depends. What are you most comfortable with? Are there any open source tools written that helps you get a jump start? If so, what language are those in?

ryantroop 177 Practically a Master Poster

you need to attached a handler to the window object and get the event's keyCode. If they keyCode is equal to the enter value (42 or something? I don't know off hand), then you create a new "listener" row.

Since the window is listening, you can figure out the keyCode and convert it back to a value/letter and append it to the innerHTML of the currently selected element.

If you are asking for someone to do this for you, Im certain most if not all here would encourage you to try first, and we can help from there.

If you intend on taking up this task, google "keyCode" and you will find that for cross browser use you will also need charCode, or with the latest broken version of key tracking, which. If I recall, you will also want to listen to the keypress event, not the keydown or keyup... or maybe it's keyUp... it's been a while since I have had to do anything with keypress listening.

This site will also be helpful http://www.w3.org/2002/09/tests/keys.html

The code in there will also be useful (if you view the source), and see what they did to disassemble their method.

Good luck!

ryantroop 177 Practically a Master Poster
-------------------
|     padding     |
|                 |
|                 |
|                 |
-------------------
margin

Padding moves items inside the element away from the border of the element.
Margin moves items away from other items.

ryantroop 177 Practically a Master Poster

you have a couple options... none of them are particularly appealing...

the easiest is to do some media queries and change objects on the page as necessary.

The other way is to make a "fluid" design, and redo everything with % or javascript resizing.

ryantroop 177 Practically a Master Poster

if an input field is flagged disabled it will not post in a form submission.

So..

<form method="post" action="whatever.cfm">
<input name="a" type="text" />
<input name="b" type="text" disabled="disabled" />
<input name="c" type="text" disabled="disabled" />
<input type="submit" value="submit">
</form>

in javascript you can add or remove the attribute like so:

<script>

    var oFormElemb = document.forms[0].b.removeAttribute("disabled"); //enable element
    var oFormElema = document.forms[0].a.setAttribute("disabled", "disabled"); //disable element

</script>

the reason you need "disabled" to equald "disabled" is that in HTML all that is required is the word,
i.e. <input name="a" type="text" disabled /> however, in XHTML (and to make IE happy) you need it to equal something, therefore the standard is to make it equal disabled.

Hope that helps!

Ryan

ryantroop 177 Practically a Master Poster

have you tried inline styles on the html elements?

ex:
<div style="height:100px; width:100px; box-shadow:2px 2px 5px #000000;">A div</div>

The other option is to try and pu the stylesheet directly on the html in style tags like a script tag... not sure how Wix works, but whatever you control you can affect change on. If you know CSS very well, you may want to take a look to see if they have a tighter constraint on your classes than you do.

Without seeing the site, it's hard to give any other ideas...

ryantroop 177 Practically a Master Poster

not to be a jerk... but...

http://www.w3schools.com/php/php_mysql_intro.asp

you're asking for a web app to be made for you... people get paid for that. If you wish to do it on your own, there are resources to help you.

ryantroop 177 Practically a Master Poster

The answer is "probably." The reality is that no one will want to publicly help you because doing so would do 2 things:

1) break the law. (why?! Because you are using copyrighted material for whatever you plan on using it for)
2) piss off google. (why?! By changing it into mp3 you are deleting their adverts, thus breaking their TOS)

Which one is worse is up for debate, though.

ryantroop 177 Practically a Master Poster

I think that this is a fundamental misunderstanding of PHP and how it works.

When you "view source" on a web page created with PHP, you won't see any PHP code, but instead you will see the HTML that is rendered from the PHP.

The ONLY way to view PHP code is to have the file on your computer and opening it with a text/code editor of your choice. Yes, this includes notepad or whatever you like.

By the time a PHP page reaches the browser, it has already been "executed" and therefore is no longer viewable.

Does that help?

ryantroop 177 Practically a Master Poster

And Microsoft's version was JScript! :)

ryantroop 177 Practically a Master Poster

or, just don't put anything for display and it's natural state will take over. At least, I believe that to be the case...

ryantroop 177 Practically a Master Poster

First.. I don't see a checkbox anywhere.. so you may want to check your html..

Second, to me you are using php incorrectly...

PHP is a back end system, which allows for "secure" actions. You can easily move most of what you are doing to the front end with pure html, or html and javascript. Send the data to php for parsing and validation, and return your response..

For example, if you actually had check boxes, you could assign them a simple value depending on how you want to handle the data in the php.. you can give them bitwise values, or simply give them a unique name and give it a value of 1 and, as you are doing already, add a value based on the flag of 1 for checked, and 0 for not.

Before you go hopping off into the world of php, make sure your fundamental html is solid, and you understand how forms work and what options you have available.

Then, with php, you need to think about how to handle forms as a single piece, and how to manage validation. User input data is always always always dirty, and you can assume that even someone who is NOT ACTIVELY TRYING TO BREAK YOUR WEBSITE is passively trying to do it instead. With PHP, your first assumption is always going to be "incomnig data always needs to be validated" whether that means you only accept numbers, specific patterns of text, or just outright stripping out …

ryantroop 177 Practically a Master Poster

Sounds like youre using the wrong tool for the job... why not just send a power point? If youre into adobe products, just make an FLV that is independent of the browser...

Why fight with a product when many others exist and do what you want more effectively?

Just an opinion. In no way are you wrong to try what you are trying, I just feel that there is a less painful way of going about it...

ryantroop 177 Practically a Master Poster

Javascript is based on ECMAScript, which is then intepreted in a "sandbox" which is controlled by a browser to interpret the script. Javascript exists solely as a client side language, which means it requires a browser to function. This is, of course, ignoring server side javascript, which is (for the sake of this discussion) going to be ignored since it is a special use case, and not typical of the use of javascript on the web.

JAVA is a language that was developed by SUN Microsystems (yeah?). It runs off a "virtual machine", which is on a users machine, and interprets the code into byte-code for the machine it is instaleld on. JAVA comes with a bunch of stuff that makes development "easier" or "faster" if you know how to use them. JAVA can be run on any computer that has JAVA installed (the VM), but it is version dependent.

TL:DR; Javascript is a web language. JAVA is a stand-alone language, which can be integrated with browsers, run as a stand alone application, or run as a unifying programming tool, as long as the system running it has the VM instsalled.

That said, I dont like JAVA. C/C++/Python ftw! :)

Also, wikipedia is your friend.

ryantroop 177 Practically a Master Poster

Without seeing the html along with it, preferrably in a working state, this may be difficult to pin point...

At a quick glance, you have a bunch of stuff absolutely positioned... could you be inadvertantly collapsing an element by removing it's content from the flow of the page?

ryantroop 177 Practically a Master Poster

in php, you would use echo.

<?php

$myVar = "A String";

echo ($myVar);

?>

there are others... it all sort of depends on what you are trying to do.

If you want users to input data and put it on the screen, there are many ways to do that... it all sort of depends on what you want as a finished product, but they all generally follow this scenario..

1) send data with get or post (using a form or ajax call).
2) process the data.
3) spit something out (even if it's the same data that was sent in, or nothing.)

For example...
a php file called "myphp.php"...

<?php

if (isset($_GET['text']))
{
    if ($_GET['text'] != "whatever")
    {
        echo ($_GET['text']);
    }
}

?>

You could use an HTML form to send your data...

<html>
<head><title>test</title></head>
<body>
<form method="GET" action="myphp.php" target="_blank">
<input type="text" name="text" />
<input type="submit" value="Submit" />
</form>
</body>
</html>

Now, that whole "open in a new screen" thing..

since your form is targetting "_blank" it will open in a new window (unless you have an iframe called "_blank"... but then you have different issues).

I think that's what youre asking...

Hope that helps,

Ryan

ryantroop 177 Practically a Master Poster

alert is an object, which happens to be of type function, of the window. Anything in the window can be called directly, and in a "global" scope.

window.alert and alert are essentially the same thing.

ryantroop 177 Practically a Master Poster

I stand slightly corrected...you can embed executables in a pdf. Launching it through javascript... meh? Don't think it's possible outside of a browser that is running adobe acrobat, or some other pdf reader, as a plug-in.

Doing what you want seems a bit shady. Again, what are you trying to do? Maybe there is a better method that emulates your goal.

ryantroop 177 Practically a Master Poster

Have you seen this done somewhere?

pdf files are simply text with an XML structure to define visual attributes (at least, as far as I know), and javascript has nothing to do with any of it....

What are you trying to accomplish?

ryantroop 177 Practically a Master Poster

Im hoping someone could fill in a few blanks for me, so I can better understand how I need to tackle a personal project.

Obviously, it's about our wonderful friend video streaming.

As I understand it, it works as follows:

Video is taken from it's raw state (whatever the input source is), and it is encoded based on any number of our friendly video formats.. mpeg, avi, mp4, flv, etc... Each, understandably, has perks and downfalls...

This video is then placed on a "host" site... this is where some of the blanks begin...

Is there a special server required for video/audio? What does it do differently than a "regular" host?

When sending video, if it's sent via http, doesn't it send the full file to the target for handling?

If it is sent to an embedded player, like what is being used for html5 <video> with <object> and <embed> as fallbacks, how does the player know to accept chunks of data for streaming instead of a full video being transferred?

If sending over rtmp instead, is it only a matter of changing the header info? What needs to be set up to accept the difference in connection type? Can rtmp be bi-directional? (or.. as I think I read it, rtmp is bi-directional by standard as it remains persistent?). If using rtmp, are you limited to flash/flv?

I think that's enough to get started... any clarification, or direction to reading/tutorials/etc.. would be much appreciated. I don't mind reading on my own …

ryantroop 177 Practically a Master Poster

Great! Mark it solved and happy coding :)

ryantroop 177 Practically a Master Poster

it looks like youre returning a script tag from the AJAX call. That's fine, if the script tag does something.. in this case, when URL encoded, it seems to do a lot of document.writes with data... Something Im sure you can do far more cleanly with some work, but that's another issue.

Since youre using innerHTML, the script tag is going to be ignored (if I recall correctly). I believe that you will have to actually create a script element on the page, give it a source, then append it to the document item you want it to be part of. I am fairly certain that you will not want the http:// as part of the source, as that will probably raise cross site scripting errors.

Your php script should simply return the src of the js file you want to insert.

Your code would look something like...

function loadPageContents() {
  var AJAX = new XMLHttpRequest();
  AJAX.open('GET','rss2.php',true);
  AJAX.onreadystatechange = function() {
    if(this.readyState==4 && this.responseText) {
      var Script = document.createElement("SCRIPT");
      Script.src = this.responseText; //this should be a relative path...

      var Container = document.getElementById('RSS_Feed');
      Container.appendChild(Script);

      setTimeout(loadPageContents, 5000);
    }
  }
  AJAX.send(null);
}

However, this would probably end up making a TON of code spattering all over your page...

Also, your return is sending back a <head> node, a <link> a <div> and then finally the script tag.

You're making bad markup that way...

I think you need to reconsider how you are pushing data to your page.. the PHP should be …

ryantroop 177 Practically a Master Poster

XMLHttpRequest is case sensitive.

line 6 should be:

var AJAX = new XMLHttpRequest();

also, relooking through your code,

you never close your script tag in the body... try this instead:

<head>
<link rel="stylesheet" type="text/css" href="rss.css" media="screen" />
<script language="javascript" src="js/jquery-2.0.1.min.js"></script>
<script language="javascript">
function loadPageContents() {
  var AJAX = new XMLHttpRequest();
  AJAX.open('GET','rss2.php',true);
  AJAX.onreadystatechange = function() {
    if(this.readyState==4 && this.responseText) {
      document.getElementById('RSS_Feed').innerHTML = this.responseText;
      setTimeout(loadPageContents, 5000);
    }
  }
  AJAX.send(null);
}

function body_load()
{
  setTimeout(loadPageContents, 5000);
}

}

</script>
</head>
<body style="margin: 0px;" onload="body_load();">
<div id="RSS_Feed">
</div>
</body>
ryantroop 177 Practically a Master Poster

may just be a stylistic thing... but Im not sure why you do

loadingPage = setTimeout(....);

I do not believe setTimeout returns anything... however, that's also not your problem.

While doing a setTimeout('string', number) will essentially do an implicit eval on the string, it's "bad mojo" and may be the source of your problem.

Try instead to replace that line with:

setTimeout(loadPageContents, 5000);

You don't need the () as it is implied in the setTimout() that the function is being called.

I think that should fix your problem... but shrug I have been wrong in the past ;)

ryantroop 177 Practically a Master Poster

Yes, the above is a much better approach :)

Note to self: don't answer questions late at night without thinking them through..

you are correct that making a new page each time would be a storage nightmare.

ryantroop 177 Practically a Master Poster

So the box you type in is an element of a "FORM" (the HTML part).. specifically:

<form action="http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/456118/dynamically-creating-new-page" method="post" accept-charset="utf-8" id="reply-form" class="user-input"> ......

and a ton of other stuff they use to make it look pretty.

This form posts (method="post") a bunch of data (form elements, which have been omitted for space) to the page (action="....") and the page has PHP on it that knows how to handle the data.

Now lets say the page didn't exist (like you're saying).

Depending on how you have your structure set up, you can use PHP (or any server side language) to make a new directory or file based on whatever you have set up. In the case of daniweb, they rely on a folder defauling to index.php when an index.html is not present.

In php, you would use something like:

if (!file_exists('path/to/directory')) {
    mkdir('path/to/directory');
}

(borrowed the above from http://stackoverflow.com/questions/2303372/create-a-folder-if-it-doesnt-already-exist)

mkdir makes the directory, it's then up to you to tell it to make a page (or file) as well..

it may not be the exact way daniweb does it, but they probably use something similar to file_put_contents() or a series of functions that emulate it. You can find that here:
http://www.php.net/manual/en/function.file-put-contents.php

In short, there is a forum "template" that daniweb copies to a new directory based on the thread title. The directory is created upon the initial form post (the poster), and the page has script to handle successive setting and getting …

ryantroop 177 Practically a Master Poster

note... you may need to tweak that code a bit... Im pretty sure that if you don't have a document body at run time, that will error out... so you can either put that code all the way at the bottom of the page, or just make sure the body is available to attach a handler.

ryantroop 177 Practically a Master Poster

Im not very familliar with mootools, so I will explain what I would do in JS and hopefully you can translate it.

an IFrame doesn't have to be visible to load data, and an IFrame has a .onload trigger. So... you can have the default inline style of the iframe to visibility:hidden; (note, not display:none;), and use the iframe's onload to run a function that simply flips the switch (i.e., iframe.style.visibility = ""; )

Without knowing the full order of loading, it's a bit difficult to tell you how to do it... it may be that on your parent page you need a function that does the visibility="" for you, and you have to put the onload on the body of the iframe content using something like...

function doShow()
{
  if (parent.showFunction) { parent.showFunction(); }; 
}

document.body.onload = doShow();

or if you want to be fully compliant you can add the event handler in your flavor of choice...

Hope that helps..

Ryan

ryantroop 177 Practically a Master Poster

IFrames do not resize happily with javascript, last I tried it...

You may need to force attribute changes by doing iFrame.setAttribute("height", number); //you may need number+"px" I forget

ryantroop 177 Practically a Master Poster

Im 99% sure this site is HTML front end with JavaScript for dynamic page enhancements (all the fun animation stuffs), CSS to make it pretty, with a PHP back end most likely drawing content fron a MySQL database.

The HTML is what gives the page "structure"
CSS tells the browser (IE, Chrome, etc..) what the layout/flow of the page should look like.
The Javascript breaks it... no wait.. it "enhances" it. That's the one... It also helps modify the CSS if necessary, or make calls behind the scenes.

The PHP is what does repetitive "dynamic" creation of content. It pulls data from a database (in DaniWebs case, most likely MySQL), and displays that content in the defined structure of the HTML/Javascript/CSS.

Is that what you were looking for?

ryantroop 177 Practically a Master Poster

so, without you knowing how PHP is used, it's a bit difficult.. but maybe this will help...

2 pages.

Page 1:
example.html

<html>
<head>
<title>AJAX Example</title>
<script type="text/javascript">

function myAJAX()
{
  var textBox = document.getElementById("myText");
  var myString = textBox.value;

  if (myString.length.replace(" ","") < 1)
    {
      alert ("You need to put something in the box!!!");
      return false;
    }

  //try to create an AJAX object in the browser....
  var AJAXObj;

  try
    {
      AJAXObj = (window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP"));
    }
  catch (e)
    {
      alert ("Your browser does not support AJAX calls. Sorry :-/");
    }


  //set a callback function, for when we get a response from the server (the PHP page).
  AJAXObj.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
        alert(AJAXObj.responseText);
    }
  }


  //try to open a connection: open(METHOD, URL, ASYNC) -- since we are doing a "GET" we are going to add
  //all of our params to the "URL" by adding a "?" and then name=value pairs.

  AJAXObj.open("GET", "myAJAX.php?string=" + myString, true);
  AJAXObj.send(); //sends our request.
}

</script>
</head>
<body>
<input type="text" id="myText" />
<input type="button" onclick="myAJAX();" />
</body>
</html>

save the above as example.html
next page is going to be our PHP page:
myAJAX.php

<?php

if(isset($_GET['string']))
{
  echo ("Your string was: " . $_GET['string']);
}

?>

save as myAJAX.php

Move both to your server. Open example.html. You now have a working AJAX call.

You will see that the JAVASCRIPT and the PHP are totally separate, and the JAVASCRIPT sends information to the PHP which simply waits …

ryantroop 177 Practically a Master Poster
ryantroop 177 Practically a Master Poster

I think the IFRAME is technically "outside" the control of the window (for security reasons).

You can try removing the http: and instead do:

window.open("//test/forms/.....");

this way, you are not "leaving" the server to come back to the server, thus creating a security hole. If the double whack doesn't work, try just making a relative path from the IFrame src.

Alternatively, you can try to make the iframe src a relative path instead of http(s) so it is not "leaving" the server. Personally, I think this is probably your issue more than the former...

ryantroop 177 Practically a Master Poster

depending on your back end... this seems like it's more of a database/sort issue... but if really all you need to do is append +whatever to the url...

function submit()
{
    var mySelectBox = document.getElementById("mySelectBox");
    var myWord = mySelectBox.options[mySelectBox.selectedIndex].text;

    var URL = document.URL;
    if (URL.lastIndexOf("/") != URL.length)  /* this assumes URL ends with "/" */
        URL += "+";

    URL += String(myWord); //cast for sanity


    window.location = URL;  //if this doesn't work try window.location.href = URL (or use both for sanity).
}

so on your "submit" button, your onclick="submit();" alternatively, if you are submitting a form you can do onsubmit="submit();" on the form... so many ways to cook chicken...

if your URL does not end with "/" you can do any number of string surgery operations to figure out if you need to pre-append a "+". For example, you can use URL.lastIndexOf(".com") != URL.length - 4

This is really not the best way to do this, but if it is what's required for your system then it's what you need.